diff --git a/api/src/event.rs b/api/src/event.rs index a6b7bf4..918e4b2 100644 --- a/api/src/event.rs +++ b/api/src/event.rs @@ -184,6 +184,9 @@ pub struct CommitEvent { /// The total amount of hashpower this miner has committed to the block. pub permit_commitment: u64, + /// The fee paid per hash. + pub fee: u64, + /// The timestamp of the event. pub ts: i64, } @@ -209,6 +212,9 @@ pub struct UncommitEvent { /// The total amount of hashpower this miner has committed to the block. pub permit_commitment: u64, + /// The fee paid per hash. + pub fee: u64, + /// The timestamp of the event. pub ts: i64, } diff --git a/program/src/commit.rs b/program/src/commit.rs index b46e372..e699c0f 100644 --- a/program/src/commit.rs +++ b/program/src/commit.rs @@ -116,6 +116,7 @@ pub fn process_commit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul amount, block_commitment: block.total_committed, permit_commitment: permit.commitment, + fee, ts: clock.unix_timestamp, } .to_bytes(), diff --git a/program/src/uncommit.rs b/program/src/uncommit.rs index 4b8d802..6c7a133 100644 --- a/program/src/uncommit.rs +++ b/program/src/uncommit.rs @@ -61,6 +61,8 @@ pub fn process_uncommit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes block.total_committed -= amount; // Close permit account, if empty. + let fee = permit.fee; + let commitment = permit.commitment; if permit.commitment == 0 { permit_info.close(signer_info)?; } @@ -74,8 +76,9 @@ pub fn process_uncommit(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramRes authority: *signer_info.key, block_id: block.id, block_commitment: block.total_committed, - permit_commitment: permit.commitment, + permit_commitment: commitment, amount, + fee, ts: clock.unix_timestamp, } .to_bytes(),