forked from lthn/blockchain
added fee bruning
This commit is contained in:
parent
e163c5f691
commit
a45d63bdf8
2 changed files with 17 additions and 2 deletions
|
|
@ -1345,7 +1345,12 @@ bool blockchain_storage::validate_miner_transaction(const block& b,
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64_t block_reward = base_reward + fee;
|
||||
uint64_t block_reward = base_reward;
|
||||
// we burn fees after hardfork 4
|
||||
if (b.miner_tx.version < TRANSACTION_VERSION_POST_HF4)
|
||||
{
|
||||
block_reward += fee;
|
||||
}
|
||||
|
||||
crypto::hash tx_id_for_post_hf4_era = b.miner_tx.version > TRANSACTION_VERSION_PRE_HF4 ? get_transaction_hash(b.miner_tx) : null_hash;
|
||||
if (!check_tx_balance(b.miner_tx, tx_id_for_post_hf4_era, block_reward))
|
||||
|
|
@ -6663,6 +6668,10 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||
return false;
|
||||
}
|
||||
bei.already_generated_coins = already_generated_coins - burned_coins + base_reward;
|
||||
if (bei.bl.miner_tx.version >= TRANSACTION_VERSION_POST_HF4)
|
||||
{
|
||||
bei.already_generated_coins -= fee_summary;
|
||||
}
|
||||
|
||||
auto blocks_index_ptr = m_db_blocks_index.get(id);
|
||||
if (blocks_index_ptr)
|
||||
|
|
|
|||
|
|
@ -380,7 +380,13 @@ namespace currency
|
|||
LOG_ERROR("Block is too big");
|
||||
return false;
|
||||
}
|
||||
uint64_t block_reward = block_reward_without_fee + fee;
|
||||
|
||||
uint64_t block_reward = block_reward_without_fee;
|
||||
// burn fees after HF4
|
||||
if (tx_version < TRANSACTION_VERSION_POST_HF4)
|
||||
{
|
||||
block_reward += fee;
|
||||
}
|
||||
|
||||
if (!destinations.size())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue