diff --git a/src/currency_core/blockchain_storage.cpp b/src/currency_core/blockchain_storage.cpp index 0388b733..59b0dd16 100644 --- a/src/currency_core/blockchain_storage.cpp +++ b/src/currency_core/blockchain_storage.cpp @@ -1322,17 +1322,10 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t if (is_hardfork_active(ZANO_HARDFORK_04_ZARCANUM)) // TODO @#@# consider moving to validate_tx_for_hardfork_specific_terms { - if (pos) - { - CHECK_AND_ASSERT_MES(b.miner_tx.proofs.size() == 1, false, "coinbase transaction has incorrect number of proofs (" << b.miner_tx.proofs.size() << "), expected 2"); - CHECK_AND_ASSERT_MES(b.miner_tx.proofs[0].type() == typeid(zc_outs_range_proof), false, "coinbase transaction has incorrect type of proof #0 (expected: zc_outs_range_proof)"); - } - else - { - CHECK_AND_ASSERT_MES(b.miner_tx.proofs.size() == 2, false, "coinbase transaction has incorrect number of proofs (" << b.miner_tx.proofs.size() << "), expected 2"); - CHECK_AND_ASSERT_MES(b.miner_tx.proofs[0].type() == typeid(zc_outs_range_proof), false, "coinbase transaction has incorrect type of proof #0 (expected: zc_outs_range_proof)"); - CHECK_AND_ASSERT_MES(b.miner_tx.proofs[1].type() == typeid(zc_balance_proof), false, "coinbase transaction has incorrect type of proof #1 (expected: zc_balance_proof)"); - } + CHECK_AND_ASSERT_MES(b.miner_tx.attachment.empty(), false, "coinbase transaction has attachments; attachments are not allowed for coinbase transactions."); + CHECK_AND_ASSERT_MES(b.miner_tx.proofs.size() == 2, false, "coinbase transaction has incorrect number of proofs (" << b.miner_tx.proofs.size() << "), expected 2"); + CHECK_AND_ASSERT_MES(b.miner_tx.proofs[0].type() == typeid(zc_outs_range_proof), false, "coinbase transaction has incorrect type of proof #0 (expected: zc_outs_range_proof)"); + CHECK_AND_ASSERT_MES(b.miner_tx.proofs[1].type() == typeid(zc_balance_proof), false, "coinbase transaction has incorrect type of proof #1 (expected: zc_balance_proof)"); } else { diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 19d8758e..f04ac527 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3831,7 +3831,7 @@ bool wallet2::is_in_hardfork_zone(uint64_t hardfork_index) const return m_core_runtime_config.is_hardfork_active_for_height(hardfork_index, get_blockchain_current_size()); } //---------------------------------------------------------------------------------------------------- -bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const pos_entry& pe, const currency::outputs_generation_context& miner_tx_ogc) const +bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const pos_entry& pe, currency::outputs_generation_context& miner_tx_ogc) const { bool r = false; WLT_CHECK_AND_ASSERT_MES(pe.wallet_index < m_transfers.size(), false, "invalid pe.wallet_index: " << pe.wallet_index); @@ -3987,6 +3987,9 @@ bool wallet2::prepare_and_sign_pos_block(const mining_context& cxt, currency::bl static_cast(sig), &err); WLT_CHECK_AND_ASSERT_MES(r, false, "zarcanum_generate_proof failed, err: " << (int)err); + // TODO @#@# [architecture] the same value is calculated in zarcanum_generate_proof(), consider an impovement + miner_tx_ogc.pseudo_out_amount_commitments_sum += cxt.stake_amount * currency::native_coin_asset_id_pt + pseudo_out_amount_blinding_mask * crypto::c_point_G; + // // The miner tx prefix should be sealed by now, and the tx hash should be defined. // Any changes made below should only affect the signatures/proofs and should not impact the prefix hash calculation. diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 1b2d436c..e5799fcd 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -856,7 +856,7 @@ namespace tools //next functions in public area only becausce of test_generator //TODO: Need refactoring - remove it back to private zone void set_genesis(const crypto::hash& genesis_hash); - bool prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const currency::pos_entry& pe, const currency::outputs_generation_context& miner_tx_ogc) const; + bool prepare_and_sign_pos_block(const mining_context& cxt, currency::block& b, const currency::pos_entry& pe, currency::outputs_generation_context& miner_tx_ogc) const; void process_new_blockchain_entry(const currency::block& b, const currency::block_direct_data_entry& bche, const crypto::hash& bl_id, diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp index 1c19c459..2615a5ef 100644 --- a/tests/core_tests/chaingen.cpp +++ b/tests/core_tests/chaingen.cpp @@ -362,7 +362,7 @@ bool test_generator::construct_block(currency::block& blk, bool test_generator::sign_block(const tools::wallet2::mining_context& mining_context, const pos_entry& pe, const tools::wallet2& w, - const outputs_generation_context& miner_tx_ogc, + outputs_generation_context& miner_tx_ogc, currency::block& b) { bool r = w.prepare_and_sign_pos_block(mining_context, b, pe, miner_tx_ogc); diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index d8905f6c..605f7fe0 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -467,7 +467,7 @@ public: bool sign_block(const tools::wallet2::mining_context& mining_context, const currency::pos_entry& pe, const tools::wallet2& w, - const currency::outputs_generation_context& miner_tx_ogc, + currency::outputs_generation_context& miner_tx_ogc, currency::block& b); /*bool get_output_details_by_global_index(const test_generator::blockchain_vector& blck_chain,