1
0
Fork 0
forked from lthn/blockchain

construct_miner_tx() doesn't clear result tx anymore, allowing to pass additional data in extra

This commit is contained in:
sowle 2024-09-17 17:59:37 +02:00
parent 35427f8381
commit 9d213b19b1
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
2 changed files with 3 additions and 1 deletions

View file

@ -474,7 +474,7 @@ namespace currency
}
CHECK_AND_ASSERT_MES(destinations.size() <= CURRENCY_TX_MAX_ALLOWED_OUTS || height == 0, false, "Too many outs (" << destinations.size() << ")! Miner tx can't be constructed.");
tx = AUTO_VAL_INIT_T(transaction);
// tx is not cleared intentionally to allow passing additional args in the extra/attachments
tx.version = tx_version;
tx_generation_context tx_gen_context{};

View file

@ -169,6 +169,7 @@ void pos_block_builder::step4_generate_coinbase_tx(size_t median_size,
uint64_t block_reward_without_fee = 0;
m_block_reward = 0;
size_t estimated_block_size = m_txs_total_size;
m_block.miner_tx = transaction{};
bool r = construct_miner_tx(m_height, median_size, already_generated_coins, estimated_block_size, m_total_fee,
reward_receiver_address, stakeholder_address, m_block.miner_tx, block_reward_without_fee, m_block_reward, tx_version, extra_nonce, max_outs, true, pe, &m_miner_tx_tgc, tx_one_time_key_to_use);
CHECK_AND_ASSERT_THROW_MES(r, "construct_miner_tx failed");
@ -177,6 +178,7 @@ void pos_block_builder::step4_generate_coinbase_tx(size_t median_size,
size_t cumulative_size = 0;
for (size_t try_count = 0; try_count != 10; ++try_count)
{
m_block.miner_tx = transaction{};
r = construct_miner_tx(m_height, median_size, already_generated_coins, estimated_block_size, m_total_fee,
reward_receiver_address, stakeholder_address, m_block.miner_tx, block_reward_without_fee, m_block_reward, tx_version, extra_nonce, max_outs, true, pe, &m_miner_tx_tgc, tx_one_time_key_to_use);
CHECK_AND_ASSERT_THROW_MES(r, "construct_homemade_pos_miner_tx failed");