1
0
Fork 0
forked from lthn/blockchain

chaingen: pos_block_builder improved (WIP), moved from construct_homemade_pos_miner_tx() to the standard one

This commit is contained in:
sowle 2022-11-08 00:06:52 +01:00
parent d2469c6473
commit e1bec6cc2f
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 12 additions and 6 deletions

View file

@ -1373,7 +1373,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
pb.step2_set_txs(std::vector<transaction>());
pb.step3_build_stake_kernel(stake_output_amount, stake_output_gidx, stake_output_key_image, diff, prev_id, null_hash, prev_block.timestamp);
pb.step4_generate_coinbase_tx(generator.get_timestamps_median(prev_id), generator.get_already_generated_coins(prev_block), miner_acc.get_public_address(),
blobdata(), CURRENCY_MINER_TX_MAX_OUTS, tx_key);
blobdata(), CURRENCY_MINER_TX_MAX_OUTS, &tx_key);
// The builder creates PoS miner tx with normal outputs.
// Replace all miner_tx outputs with one multisig output and re-sign it.

View file

@ -345,6 +345,7 @@ bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const bo
return true;
}
*/
bool mine_next_pos_block_in_playtime_sign_cb(currency::core& c, const currency::block& prev_block, const currency::block& coinstake_scr_block, const currency::account_base& acc,

View file

@ -54,18 +54,22 @@ struct pos_block_builder
const currency::account_public_address &stakeholder_address,
const currency::blobdata& extra_nonce = currency::blobdata(),
size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS,
currency::keypair tx_one_time_key = currency::keypair::generate());
const currency::keypair* tx_one_time_key_to_use = nullptr
);
void step4_generate_coinbase_tx(size_t median_size,
const boost::multiprecision::uint128_t& already_generated_coins,
const currency::account_public_address &reward_and_stake_receiver_address,
const currency::blobdata& extra_nonce = currency::blobdata(),
size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS,
currency::keypair tx_one_time_key = currency::keypair::generate());
const currency::keypair* tx_one_time_key_to_use = nullptr
);
void step5_sign(const currency::tx_source_entry& se, const currency::account_keys& stakeholder_keys);
void step5_sign(const crypto::public_key& stake_tx_pub_key, size_t stake_tx_out_index, const crypto::public_key& stake_tx_out_pub_key, const currency::account_base& stakeholder_account);
void step5_sign_zarcanum(const crypto::public_key& stake_tx_pub_key, size_t stake_tx_out_index, const currency::account_base& stakeholder_account);
//void step5_sign_zarcanum(const crypto::public_key& stake_tx_pub_key, size_t stake_tx_out_index, const currency::account_base& stakeholder_account);
currency::block m_block {};
@ -76,11 +80,12 @@ struct pos_block_builder
size_t m_height = 0;
size_t m_pos_stake_output_gindex = 0;
//uint64_t m_pos_stake_amount = 0;
crypto::scalar_t m_blinding_masks_sum {}; // bliding masks of zc outputs of miner tx
currency::pos_mining_context m_context {};
};
bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
/* bool construct_homemade_pos_miner_tx(bool zarcanum, size_t height, size_t median_size, const boost::multiprecision::uint128_t& already_generated_coins,
size_t current_block_size,
uint64_t fee,
uint64_t pos_stake_amount,
@ -91,7 +96,7 @@ bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const bo
currency::transaction& tx,
const currency::blobdata& extra_nonce = currency::blobdata(),
size_t max_outs = CURRENCY_MINER_TX_MAX_OUTS,
currency::keypair tx_one_time_key = currency::keypair::generate());
currency::keypair tx_one_time_key = currency::keypair::generate()); */
bool mine_next_pos_block_in_playtime_sign_cb(currency::core& c, const currency::block& prev_block, const currency::block& coinstake_scr_block, const currency::account_base& acc,
std::function<bool(currency::block&)> before_sign_cb, currency::block& output);