add block hash references to the matured block rewards

This commit is contained in:
Aaron Blankstein
2020-11-04 10:47:08 -06:00
parent 0f72c10090
commit cd9073e3c9
4 changed files with 14 additions and 29 deletions

View File

@@ -74,7 +74,9 @@ Example:
"coinbase_amount": "1000",
"tx_fees_anchored_shared": "800",
"tx_fees_anchored_exclusive": "0",
"tx_fees_streamed_confirmed": "0"
"tx_fees_streamed_confirmed": "0",
"from_stacks_block_hash": "0xf5d4ce0efe1d42c963d615ce57f0d014f263a985175e4ece766eceff10e0a358",
"from_index_block_hash": "0x329efcbcc6daf5ac3f264522e0df50eddb5be85df6ee8a9fc2384c54274d7afc",
}
]
}

View File

@@ -57,6 +57,8 @@ pub struct MinerReward {
pub tx_fees_streamed_produced: u128,
pub tx_fees_streamed_confirmed: u128,
pub vtxindex: u32, // will be 0 for the reward to the miner, and >0 for user burn supports
pub from_block_consensus_hash: ConsensusHash,
pub from_stacks_block_hash: BlockHeaderHash,
}
impl FromRow<MinerPaymentSchedule> for MinerPaymentSchedule {
@@ -116,30 +118,6 @@ impl FromRow<MinerPaymentSchedule> for MinerPaymentSchedule {
}
impl MinerReward {
pub fn empty_miner(address: &StacksAddress) -> MinerReward {
MinerReward {
address: address.clone(),
coinbase: 0,
tx_fees_anchored_shared: 0,
tx_fees_anchored_exclusive: 0,
tx_fees_streamed_produced: 0,
tx_fees_streamed_confirmed: 0,
vtxindex: 0,
}
}
pub fn empty_user(address: &StacksAddress, vtxindex: u32) -> MinerReward {
MinerReward {
address: address.clone(),
coinbase: 0,
tx_fees_anchored_shared: 0,
tx_fees_anchored_exclusive: 0,
tx_fees_streamed_produced: 0,
tx_fees_streamed_confirmed: 0,
vtxindex: vtxindex,
}
}
pub fn total(&self) -> u128 {
self.coinbase
+ self.tx_fees_anchored_shared
@@ -614,6 +592,8 @@ impl StacksChainState {
tx_fees_streamed_produced: 0,
tx_fees_streamed_confirmed: 0,
vtxindex: miner.vtxindex,
from_stacks_block_hash: miner.block_hash.clone(),
from_block_consensus_hash: miner.consensus_hash.clone(),
};
miner_reward
}

View File

@@ -3753,9 +3753,9 @@ impl StacksChainState {
/// block's transactions. Finally, it returns the execution costs for the microblock stream
/// and for the anchored block (separately).
/// Returns None if we're out of blocks to process.
fn append_block<'a>(
chainstate_tx: &mut ChainstateTx<'a>,
clarity_instance: &'a mut ClarityInstance,
fn append_block(
chainstate_tx: &mut ChainstateTx,
clarity_instance: &mut ClarityInstance,
burn_dbconn: &dyn BurnStateDB,
parent_chain_tip: &StacksHeaderInfo,
chain_tip_consensus_hash: &ConsensusHash,

View File

@@ -424,7 +424,10 @@ impl EventDispatcher {
"coinbase_amount": reward.coinbase.to_string(),
"tx_fees_anchored_shared": reward.tx_fees_anchored_shared.to_string(),
"tx_fees_anchored_exclusive": reward.tx_fees_anchored_exclusive.to_string(),
"tx_fees_streamed_confirmed": reward.tx_fees_streamed_confirmed.to_string()
"tx_fees_streamed_confirmed": reward.tx_fees_streamed_confirmed.to_string(),
"from_stacks_block_hash": format!("0x{}", &reward.from_stacks_block_hash),
"from_index_consensus_hash": format!("0x{}", StacksBlockId::new(&reward.from_block_consensus_hash,
&reward.from_stacks_block_hash)),
})
})
.collect();