forked from lthn/blockchain
tx stracture changes: in progress 3 + signatures converting to varian signature: in progress
This commit is contained in:
parent
7e5c504357
commit
389209ff02
21 changed files with 412 additions and 264 deletions
|
|
@ -25,11 +25,19 @@ usage:
|
|||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
|
||||
VARIANT_SWITCH_BEGIN(o);
|
||||
VARIANT_CASE(txout_to_key, o)
|
||||
VARIANT_CASE_TV(txout_multisig)
|
||||
VARIANT_CASE_TV(txout_htlc)
|
||||
VARIANT_CASE(txout_to_key, o);
|
||||
VARIANT_CASE_TV(txout_multisig);
|
||||
VARIANT_CASE_TV(txout_htlc);
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
|
||||
|
||||
VARIANT_SWITCH_BEGIN(s);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures);
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -609,9 +609,18 @@ bool blockchain_storage::prune_ring_signatures_and_attachments(uint64_t height,
|
|||
"is mot equal to height = " << height << " in blockchain index, for block on height = " << height);
|
||||
|
||||
transaction_chain_entry lolcal_chain_entry = *it;
|
||||
signatures_pruned += lolcal_chain_entry.tx.signatures.size();
|
||||
VARIANT_SWITCH_BEGIN(lolcal_chain_entry.tx.signature);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
{
|
||||
signatures_pruned += signatures.s.size();
|
||||
signatures.s.clear();
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
attachments_pruned += lolcal_chain_entry.tx.attachment.size();
|
||||
lolcal_chain_entry.tx.signatures.clear();
|
||||
lolcal_chain_entry.tx.attachment.clear();
|
||||
|
||||
//reassign to db
|
||||
|
|
@ -4286,8 +4295,17 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
|
|||
{
|
||||
if (!m_is_in_checkpoint_zone)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(sig_index < tx.signatures.size(), false, "Wrong transaction: missing signature entry for input #" << sig_index << " tx: " << tx_prefix_hash);
|
||||
psig = &tx.signatures[sig_index];
|
||||
VARIANT_SWITCH_BEGIN(tx.signatures);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures);
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(sig_index < tx.signatures.s.size(), false, "Wrong transaction: missing signature entry for input #" << sig_index << " tx: " << tx_prefix_hash);
|
||||
psig = &signatures.s[sig_index];
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
}
|
||||
|
||||
if (txin.type() == typeid(txin_to_key))
|
||||
|
|
@ -4585,47 +4603,65 @@ bool blockchain_storage::check_ms_input(const transaction& tx, size_t in_index,
|
|||
LOC_CHK(!have_type_in_variant_container<extra_attachment_info>(txin.etc_details), "Incorrect using of extra_attachment_info in etc_details in input #" << in_index << " for tx " << tx_prefix_hash);
|
||||
}
|
||||
|
||||
LOC_CHK(tx.signatures.size() > in_index, "ms input index is out of signatures container bounds, tx.signatures.size() = " << tx.signatures.size());
|
||||
const std::vector<crypto::signature>& input_signatures = tx.signatures[in_index];
|
||||
|
||||
size_t expected_signatures_count = txin.sigs_count;
|
||||
bool need_to_check_extra_sign = false;
|
||||
if (get_tx_flags(tx)&TX_FLAG_SIGNATURE_MODE_SEPARATE && in_index == tx.vin.size() - 1) // last input in TX_FLAG_SIGNATURE_MODE_SEPARATE must contain one more signature to ensure that tx was completed by an authorized subject
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
{
|
||||
expected_signatures_count++;
|
||||
need_to_check_extra_sign = true;
|
||||
}
|
||||
LOC_CHK(tx.signatures.size() > in_index, "ms input index is out of signatures container bounds, tx.signatures.size() = " << tx.signatures.size());
|
||||
const std::vector<crypto::signature>& input_signatures = signatures.s[in_index];
|
||||
|
||||
LOC_CHK(expected_signatures_count == input_signatures.size(), "Invalid input's signatures count: " << input_signatures.size() << ", expected: " << expected_signatures_count);
|
||||
|
||||
crypto::hash tx_hash_for_signature = prepare_prefix_hash_for_sign(tx, in_index, tx_prefix_hash);
|
||||
LOC_CHK(tx_hash_for_signature != null_hash, "prepare_prefix_hash_for_sign failed");
|
||||
|
||||
LOC_CHK(txin.sigs_count <= source_ms_out_target.keys.size(), "source tx invariant failed: ms output's minimum sigs == ms input's sigs_count (" << txin.sigs_count << ") is GREATHER than keys.size() = " << source_ms_out_target.keys.size()); // NOTE: sig_count == minimum_sigs as checked above
|
||||
size_t out_key_index = 0; // index in source_ms_out_target.keys
|
||||
for (size_t i = 0; i != txin.sigs_count; /* nothing */)
|
||||
{
|
||||
// if we run out of keys for this signature, then it's invalid signature
|
||||
LOC_CHK(out_key_index < source_ms_out_target.keys.size(), "invalid signature #" << i << ": " << input_signatures[i]);
|
||||
|
||||
// check signature #i against ms output key #out_key_index
|
||||
if (crypto::check_signature(tx_hash_for_signature, source_ms_out_target.keys[out_key_index], input_signatures[i]))
|
||||
size_t expected_signatures_count = txin.sigs_count;
|
||||
bool need_to_check_extra_sign = false;
|
||||
if (get_tx_flags(tx)&TX_FLAG_SIGNATURE_MODE_SEPARATE && in_index == tx.vin.size() - 1) // last input in TX_FLAG_SIGNATURE_MODE_SEPARATE must contain one more signature to ensure that tx was completed by an authorized subject
|
||||
{
|
||||
// match: go for the next signature and the next key
|
||||
i++;
|
||||
out_key_index++;
|
||||
expected_signatures_count++;
|
||||
need_to_check_extra_sign = true;
|
||||
}
|
||||
else
|
||||
|
||||
LOC_CHK(expected_signatures_count == input_signatures.size(), "Invalid input's signatures count: " << input_signatures.size() << ", expected: " << expected_signatures_count);
|
||||
|
||||
crypto::hash tx_hash_for_signature = prepare_prefix_hash_for_sign(tx, in_index, tx_prefix_hash);
|
||||
LOC_CHK(tx_hash_for_signature != null_hash, "prepare_prefix_hash_for_sign failed");
|
||||
|
||||
LOC_CHK(txin.sigs_count <= source_ms_out_target.keys.size(), "source tx invariant failed: ms output's minimum sigs == ms input's sigs_count (" << txin.sigs_count << ") is GREATHER than keys.size() = " << source_ms_out_target.keys.size()); // NOTE: sig_count == minimum_sigs as checked above
|
||||
size_t out_key_index = 0; // index in source_ms_out_target.keys
|
||||
for (size_t i = 0; i != txin.sigs_count; /* nothing */)
|
||||
{
|
||||
// missmatch: go for the next key for this signature
|
||||
out_key_index++;
|
||||
// if we run out of keys for this signature, then it's invalid signature
|
||||
LOC_CHK(out_key_index < source_ms_out_target.keys.size(), "invalid signature #" << i << ": " << input_signatures[i]);
|
||||
|
||||
// check signature #i against ms output key #out_key_index
|
||||
if (crypto::check_signature(tx_hash_for_signature, source_ms_out_target.keys[out_key_index], input_signatures[i]))
|
||||
{
|
||||
// match: go for the next signature and the next key
|
||||
i++;
|
||||
out_key_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// missmatch: go for the next key for this signature
|
||||
out_key_index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
if (need_to_check_extra_sign)
|
||||
{
|
||||
//here we check extra signature to validate that transaction was finilized by authorized subject
|
||||
bool r = crypto::check_signature(tx_prefix_hash, get_tx_pub_key_from_extra(tx), tx.signatures[in_index].back());
|
||||
LOC_CHK(r, "failed to check extra signature for last out with TX_FLAG_SIGNATURE_MODE_SEPARATE");
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
{
|
||||
//here we check extra signature to validate that transaction was finilized by authorized subject
|
||||
bool r = crypto::check_signature(tx_prefix_hash, get_tx_pub_key_from_extra(tx), signatures.s[in_index].back());
|
||||
LOC_CHK(r, "failed to check extra signature for last out with TX_FLAG_SIGNATURE_MODE_SEPARATE");
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -5155,32 +5191,43 @@ bool blockchain_storage::validate_pos_block(const block& b,
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//validate signature
|
||||
uint64_t max_related_block_height = 0;
|
||||
const txin_to_key& coinstake_in = boost::get<txin_to_key>(b.miner_tx.vin[1]);
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.signatures.size() == 1, false, "PoS block's miner_tx has incorrect signatures size = " << b.miner_tx.signatures.size() << ", block_id = " << get_block_hash(b));
|
||||
if (!for_altchain)
|
||||
{
|
||||
// Do coinstake input validation for main chain only.
|
||||
// Txs in alternative PoS blocks (including miner_tx) are validated by validate_alt_block_txs()
|
||||
uint64_t source_max_unlock_time_for_pos_coinbase = 0;
|
||||
r = check_tx_input(b.miner_tx, 1, coinstake_in, id, b.miner_tx.signatures[0], max_related_block_height, source_max_unlock_time_for_pos_coinbase);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to validate coinstake input in miner tx, block_id = " << get_block_hash(b));
|
||||
|
||||
if (get_block_height(b) > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
VARIANT_SWITCH_BEGIN(b.miner_tx.signature);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(signatures.s.size() == 1, false, "PoS block's miner_tx has incorrect signatures size = " << signatures.s.size() << ", block_id = " << get_block_hash(b));
|
||||
if (!for_altchain)
|
||||
{
|
||||
uint64_t last_pow_h = get_last_x_block_height(false);
|
||||
CHECK_AND_ASSERT_MES(max_related_block_height <= last_pow_h, false, "Failed to validate coinbase in PoS block, condition failed: max_related_block_height(" << max_related_block_height << ") <= last_pow_h(" << last_pow_h << ")");
|
||||
//let's check that coinbase amount and unlock time
|
||||
r = validate_pos_coinbase_outs_unlock_time(b.miner_tx, coinstake_in.amount, source_max_unlock_time_for_pos_coinbase);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to validate_pos_coinbase_outs_unlock_time() in miner tx, block_id = " << get_block_hash(b)
|
||||
<< "source_max_unlock_time_for_pos_coinbase=" << source_max_unlock_time_for_pos_coinbase);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(is_tx_spendtime_unlocked(source_max_unlock_time_for_pos_coinbase), false, "Failed to validate coinbase in PoS block, condition failed: is_tx_spendtime_unlocked(source_max_unlock_time_for_pos_coinbase)(" << source_max_unlock_time_for_pos_coinbase << ")");
|
||||
// Do coinstake input validation for main chain only.
|
||||
// Txs in alternative PoS blocks (including miner_tx) are validated by validate_alt_block_txs()
|
||||
uint64_t source_max_unlock_time_for_pos_coinbase = 0;
|
||||
r = check_tx_input(b.miner_tx, 1, coinstake_in, id, signatures.s[0], max_related_block_height, source_max_unlock_time_for_pos_coinbase);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to validate coinstake input in miner tx, block_id = " << get_block_hash(b));
|
||||
|
||||
if (get_block_height(b) > m_core_runtime_config.hard_forks.hard_fork_01_starts_after_height)
|
||||
{
|
||||
uint64_t last_pow_h = get_last_x_block_height(false);
|
||||
CHECK_AND_ASSERT_MES(max_related_block_height <= last_pow_h, false, "Failed to validate coinbase in PoS block, condition failed: max_related_block_height(" << max_related_block_height << ") <= last_pow_h(" << last_pow_h << ")");
|
||||
//let's check that coinbase amount and unlock time
|
||||
r = validate_pos_coinbase_outs_unlock_time(b.miner_tx, coinstake_in.amount, source_max_unlock_time_for_pos_coinbase);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to validate_pos_coinbase_outs_unlock_time() in miner tx, block_id = " << get_block_hash(b)
|
||||
<< "source_max_unlock_time_for_pos_coinbase=" << source_max_unlock_time_for_pos_coinbase);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(is_tx_spendtime_unlocked(source_max_unlock_time_for_pos_coinbase), false, "Failed to validate coinbase in PoS block, condition failed: is_tx_spendtime_unlocked(source_max_unlock_time_for_pos_coinbase)(" << source_max_unlock_time_for_pos_coinbase << ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
uint64_t block_height = for_altchain ? split_height + alt_chain.size() : m_db_blocks.size();
|
||||
uint64_t coinstake_age = block_height - max_related_block_height - 1;
|
||||
|
|
@ -5482,7 +5529,13 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt
|
|||
//If we under checkpoints, ring signatures should be pruned
|
||||
if(m_is_in_checkpoint_zone)
|
||||
{
|
||||
tx.signatures.clear();
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
signatures.s.clear();
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
tx.attachment.clear();
|
||||
}
|
||||
TIME_MEASURE_START_PD(tx_add_one_tx_time);
|
||||
|
|
@ -6294,12 +6347,12 @@ void blockchain_storage::calculate_local_gindex_lookup_table_for_height(uint64_t
|
|||
}
|
||||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
|
||||
std::unordered_set<crypto::key_image>& collected_keyimages,
|
||||
std::unordered_set<crypto::key_image>& collected_keyimages,
|
||||
const txs_by_id_and_height_altchain& alt_chain_tx_ids,
|
||||
const crypto::hash& bl_id,
|
||||
const crypto::hash& input_tx_hash,
|
||||
const crypto::hash& bl_id,
|
||||
const crypto::hash& input_tx_hash,
|
||||
size_t input_index,
|
||||
const std::vector<crypto::signature>& input_sigs,
|
||||
const signature_v& input_sigs,
|
||||
uint64_t split_height,
|
||||
const alt_chain_type& alt_chain,
|
||||
const std::unordered_set<crypto::hash>& alt_chain_block_ids,
|
||||
|
|
@ -6338,6 +6391,8 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
|
|||
*p_max_related_block_height = 0;
|
||||
|
||||
CHECK_AND_ASSERT_MES(input_index < input_tx.vin.size(), false, "invalid input index: " << input_index);
|
||||
|
||||
|
||||
const txin_v& input_v = input_tx.vin[input_index];
|
||||
const txin_to_key& input_to_key = get_to_key_input_from_txin_v(input_v);
|
||||
|
||||
|
|
@ -6608,12 +6663,19 @@ bool blockchain_storage::validate_alt_block_input(const transaction& input_tx,
|
|||
VARIANT_SWITCH_END();
|
||||
}
|
||||
|
||||
// do input checks (attachment_info, ring signature and extra signature, etc.)
|
||||
r = check_input_signature(input_tx, input_index, input_to_key, input_tx_hash, input_sigs, pub_key_pointers);
|
||||
CHECK_AND_ASSERT_MES(r, false, "to_key input validation failed");
|
||||
VARIANT_SWITCH_BEGIN(input_sigs);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
{
|
||||
// do input checks (attachment_info, ring signature and extra signature, etc.)
|
||||
r = check_input_signature(input_tx, input_index, input_to_key, input_tx_hash, signatures.s[input_index], pub_key_pointers);
|
||||
CHECK_AND_ASSERT_MES(r, false, "to_key input validation failed");
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
// TODO: consider checking input_tx for valid extra attachment info as it's checked in check_tx_inputs()
|
||||
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
|
@ -6684,7 +6746,7 @@ bool blockchain_storage::is_output_allowed_for_input(const output_key_or_htlc_v&
|
|||
}
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx, const crypto::hash& input_tx_hash, size_t input_index, const std::vector<crypto::signature>& input_sigs, uint64_t split_height, const alt_chain_type& alt_chain) const
|
||||
bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx, const crypto::hash& input_tx_hash, size_t input_index, const signature_v& input_sigs_v, uint64_t split_height, const alt_chain_type& alt_chain) const
|
||||
{
|
||||
// Main and alt chain outline:
|
||||
//
|
||||
|
|
@ -6713,10 +6775,12 @@ bool blockchain_storage::validate_alt_block_ms_input(const transaction& input_tx
|
|||
|
||||
CRITICAL_REGION_LOCAL(m_read_lock);
|
||||
bool r = false;
|
||||
|
||||
CHECK_AND_ASSERT_MES(input_index < input_tx.vin.size() && input_tx.vin[input_index].type() == typeid(txin_multisig), false, "invalid ms input index: " << input_index << " or type");
|
||||
CHECK_AND_ASSERT_MES(input_index < input_tx.vin.size()
|
||||
&& input_tx.vin[input_index].type() == typeid(txin_multisig)
|
||||
&& input_tx.signature.type() == typeid(NLSAG_sig), false, "invalid ms input index: " << input_index << " or type");
|
||||
const txin_multisig& input = boost::get<txin_multisig>(input_tx.vin[input_index]);
|
||||
|
||||
const std::vector<crypto::signature>& input_sigs = boost::get<NLSAG_sig>(input_tx.signature).s[input_index];
|
||||
// check corresponding ms out in the main chain
|
||||
auto p = m_db_multisig_outs.get(input.multisig_out_id);
|
||||
if (p != nullptr)
|
||||
|
|
@ -6904,12 +6968,22 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
|
|||
|
||||
if (is_pos_block(b))
|
||||
{
|
||||
// check PoS block miner tx in a special way
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.signatures.size() == 1 && b.miner_tx.vin.size() == 2, false, "invalid PoS block's miner_tx, signatures size = " << b.miner_tx.signatures.size() << ", miner_tx.vin.size() = " << b.miner_tx.vin.size());
|
||||
uint64_t max_related_block_height = 0;
|
||||
uint64_t ki_lookup = 0;
|
||||
r = validate_alt_block_input(b.miner_tx, collected_keyimages, alt_chain_tx_ids, id, get_block_hash(b), 1, b.miner_tx.signatures[0], split_height, alt_chain, alt_chain_block_ids, ki_lookup, &max_related_block_height);
|
||||
CHECK_AND_ASSERT_MES(r, false, "miner tx " << get_transaction_hash(b.miner_tx) << ": validation failed");
|
||||
|
||||
// check PoS block miner tx in a special way
|
||||
VARIANT_SWITCH_BEGIN(b.miner_tx.signature);
|
||||
VARIANT_CASE(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures);
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(signatures.s.size() == 1 && b.miner_tx.vin.size() == 2, false, "invalid PoS block's miner_tx, signatures size = " << signatures.s.size() << ", miner_tx.vin.size() = " << b.miner_tx.vin.size());
|
||||
r = validate_alt_block_input(b.miner_tx, collected_keyimages, alt_chain_tx_ids, id, get_block_hash(b), 1, signatures.s[0], split_height, alt_chain, alt_chain_block_ids, ki_lookup, &max_related_block_height);
|
||||
CHECK_AND_ASSERT_MES(r, false, "miner tx " << get_transaction_hash(b.miner_tx) << ": validation failed");
|
||||
}
|
||||
VARIANT_CASE(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
ki_lookup_time_total += ki_lookup;
|
||||
// check stake age
|
||||
uint64_t coinstake_age = height - max_related_block_height - 1;
|
||||
|
|
@ -6929,19 +7003,22 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
|
|||
CHECK_AND_ASSERT_MES(get_transaction_from_pool_or_db(tx_id, tx_ptr, split_height), false, "failed to get alt block tx " << tx_id << " with split_height == " << split_height);
|
||||
}
|
||||
const transaction& tx = it == abei.onboard_transactions.end() ? *tx_ptr : it->second;
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.size() == tx.vin.size(), false, "invalid tx: tx.signatures.size() == " << tx.signatures.size() << ", tx.vin.size() == " << tx.vin.size());
|
||||
if (tx.signature.type() == typeid(NLSAG_sig))
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(boost::get<NLSAG_sig>(tx.signature).s.size() == tx.vin.size(), false, "invalid tx: tx.signatures.size() == " << boost::get<NLSAG_sig>(tx.signature).s.size() << ", tx.vin.size() == " << tx.vin.size());
|
||||
}
|
||||
for (size_t n = 0; n < tx.vin.size(); ++n)
|
||||
{
|
||||
if (tx.vin[n].type() == typeid(txin_to_key) || tx.vin[n].type() == typeid(txin_htlc))
|
||||
{
|
||||
uint64_t ki_lookup = 0;
|
||||
r = validate_alt_block_input(tx, collected_keyimages, alt_chain_tx_ids, id, tx_id, n, tx.signatures[n], split_height, alt_chain, alt_chain_block_ids, ki_lookup);
|
||||
r = validate_alt_block_input(tx, collected_keyimages, alt_chain_tx_ids, id, tx_id, n, tx.signature, split_height, alt_chain, alt_chain_block_ids, ki_lookup);
|
||||
CHECK_AND_ASSERT_MES(r, false, "tx " << tx_id << ", input #" << n << ": validation failed");
|
||||
ki_lookup_time_total += ki_lookup;
|
||||
}
|
||||
else if (tx.vin[n].type() == typeid(txin_multisig))
|
||||
{
|
||||
r = validate_alt_block_ms_input(tx, tx_id, n, tx.signatures[n], split_height, alt_chain);
|
||||
r = validate_alt_block_ms_input(tx, tx_id, n, tx.signature, split_height, alt_chain);
|
||||
CHECK_AND_ASSERT_MES(r, false, "tx " << tx_id << ", input #" << n << " (multisig): validation failed");
|
||||
}
|
||||
else if (tx.vin[n].type() == typeid(txin_gen))
|
||||
|
|
|
|||
|
|
@ -286,13 +286,13 @@ namespace currency
|
|||
uint64_t get_aliases_count()const;
|
||||
uint64_t get_block_h_older_then(uint64_t timestamp) const;
|
||||
bool validate_tx_service_attachmens_in_services(const tx_service_attachment& a, size_t i, const transaction& tx)const;
|
||||
bool check_tx_input(const transaction& tx, size_t in_index, const txin_to_key& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, uint64_t& max_related_block_height, uint64_t& source_max_unlock_time_for_pos_coinbase)const;
|
||||
bool check_tx_input(const transaction& tx, size_t in_index, const txin_multisig& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, uint64_t& max_related_block_height)const;
|
||||
bool check_tx_input(const transaction& tx, size_t in_index, const txin_htlc& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, uint64_t& max_related_block_height)const;
|
||||
bool check_tx_input(const transaction& tx, size_t in_index, const txin_to_key& txin, const crypto::hash& tx_prefix_hash, const signature_v& sig, uint64_t& max_related_block_height, uint64_t& source_max_unlock_time_for_pos_coinbase)const;
|
||||
bool check_tx_input(const transaction& tx, size_t in_index, const txin_multisig& txin, const crypto::hash& tx_prefix_hash, const signature_v& sig, uint64_t& max_related_block_height)const;
|
||||
bool check_tx_input(const transaction& tx, size_t in_index, const txin_htlc& txin, const crypto::hash& tx_prefix_hash, const signature_v& sig, uint64_t& max_related_block_height)const;
|
||||
bool check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash, uint64_t& max_used_block_height)const;
|
||||
bool check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash) const;
|
||||
bool check_tx_inputs(const transaction& tx, const crypto::hash& tx_prefix_hash, uint64_t& max_used_block_height, crypto::hash& max_used_block_id)const;
|
||||
bool check_ms_input(const transaction& tx, size_t in_index, const txin_multisig& txin, const crypto::hash& tx_prefix_hash, const std::vector<crypto::signature>& sig, const transaction& source_tx, size_t out_n) const;
|
||||
bool check_ms_input(const transaction& tx, size_t in_index, const txin_multisig& txin, const crypto::hash& tx_prefix_hash, const signature_v& sig, const transaction& source_tx, size_t out_n) const;
|
||||
bool validate_tx_for_hardfork_specific_terms(const transaction& tx, const crypto::hash& tx_id, uint64_t block_height) const;
|
||||
bool validate_tx_for_hardfork_specific_terms(const transaction& tx, const crypto::hash& tx_id) const;
|
||||
bool get_output_keys_for_input_with_checks(const transaction& tx, const txin_v& verified_input, std::vector<crypto::public_key>& output_keys, uint64_t& max_related_block_height, uint64_t& source_max_unlock_time_for_pos_coinbase, scan_for_keys_context& scan_context) const;
|
||||
|
|
@ -597,13 +597,18 @@ namespace currency
|
|||
const crypto::hash& bl_id,
|
||||
const crypto::hash& input_tx_hash,
|
||||
size_t input_index,
|
||||
const std::vector<crypto::signature>& input_sigs,
|
||||
const signature_v& input_sigs, //const std::vector<crypto::signature>& input_sigs,
|
||||
uint64_t split_height,
|
||||
const alt_chain_type& alt_chain,
|
||||
const std::unordered_set<crypto::hash>& alt_chain_block_ids,
|
||||
uint64_t& ki_lookuptime,
|
||||
uint64_t* p_max_related_block_height = nullptr) const;
|
||||
bool validate_alt_block_ms_input(const transaction& input_tx, const crypto::hash& input_tx_hash, size_t input_index, const std::vector<crypto::signature>& input_sigs, uint64_t split_height, const alt_chain_type& alt_chain) const;
|
||||
bool validate_alt_block_ms_input(const transaction& input_tx,
|
||||
const crypto::hash& input_tx_hash,
|
||||
size_t input_index,
|
||||
const signature_v& input_sigs,//const std::vector<crypto::signature>& input_sigs,
|
||||
uint64_t split_height,
|
||||
const alt_chain_type& alt_chain) const;
|
||||
bool validate_alt_block_txs(const block& b, const crypto::hash& id, std::unordered_set<crypto::key_image>& collected_keyimages, alt_block_extended_info& abei, const alt_chain_type& alt_chain, uint64_t split_height, uint64_t& ki_lookup_time_total) const;
|
||||
bool update_alt_out_indexes_for_tx_in_block(const transaction& tx, alt_block_extended_info& abei)const;
|
||||
bool get_transaction_from_pool_or_db(const crypto::hash& tx_id, std::shared_ptr<transaction>& tx_ptr, uint64_t min_allowed_block_height = 0) const;
|
||||
|
|
|
|||
|
|
@ -196,8 +196,9 @@ namespace currency
|
|||
posin.k_image = pe.keyimage;
|
||||
tx.vin.push_back(posin);
|
||||
//reserve place for ring signature
|
||||
tx.signatures.resize(1);
|
||||
tx.signatures[0].resize(posin.key_offsets.size());
|
||||
tx.signature = NLSAG_sig();
|
||||
boost::get<NLSAG_sig>(tx.signature).s.resize(1);
|
||||
boost::get<NLSAG_sig>(tx.signature).s[0].resize(posin.key_offsets.size());
|
||||
}
|
||||
|
||||
uint64_t no = 0;
|
||||
|
|
@ -1530,8 +1531,8 @@ namespace currency
|
|||
crypto::hash tx_hash_for_signature = prepare_prefix_hash_for_sign(tx, input_index, tx_prefix_hash);
|
||||
CHECK_AND_ASSERT_MES(tx_hash_for_signature != null_hash, false, "failed to prepare_prefix_hash_for_sign");
|
||||
|
||||
tx.signatures.push_back(std::vector<crypto::signature>());
|
||||
std::vector<crypto::signature>& sigs = tx.signatures.back();
|
||||
boost::get<NLSAG_sig>(tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
std::vector<crypto::signature>& sigs = boost::get<NLSAG_sig>(tx.signature).s.back();
|
||||
|
||||
if(src_entr.is_multisig())
|
||||
{
|
||||
|
|
@ -1681,9 +1682,13 @@ namespace currency
|
|||
|
||||
size_t participant_index = std::find(out_ms.keys.begin(), out_ms.keys.end(), ms_in_ephemeral_key.pub) - out_ms.keys.begin();
|
||||
LOC_CHK(participant_index < out_ms.keys.size(), "Can't find given participant's ms key in ms output keys list");
|
||||
LOC_CHK(ms_input_index < tx.signatures.size(), "transaction does not have signatures vectory entry for ms input #" << ms_input_index);
|
||||
|
||||
//@#@
|
||||
LOC_CHK(tx.signature.type() == typeid(NLSAG_sig), "Wrong type of signature");
|
||||
|
||||
auto& sigs = tx.signature[ms_input_index];
|
||||
LOC_CHK(ms_input_index < boost::get<NLSAG_sig>(tx.signature).s.size(), "transaction does not have signatures vector entry for ms input #" << ms_input_index);
|
||||
|
||||
auto& sigs = boost::get<NLSAG_sig>(tx.signature).s[ms_input_index];
|
||||
LOC_CHK(!sigs.empty(), "empty signatures container");
|
||||
|
||||
bool extra_signature_expected = (get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE) && ms_input_index == tx.vin.size() - 1;
|
||||
|
|
@ -2856,8 +2861,8 @@ namespace currency
|
|||
txin_multisig& tms = boost::get<txin_multisig>(in);
|
||||
tei.ins.back().amount = tms.amount;
|
||||
tei.ins.back().kimage_or_ms_id = epee::string_tools::pod_to_hex(tms.multisig_out_id);
|
||||
if (tx.signatures.size() >= tei.ins.size())
|
||||
tei.ins.back().multisig_count = tx.signatures[tei.ins.size() - 1].size();
|
||||
if (tx.signature.type() == typeid(NLSAG_sig) && boost::get<NLSAG_sig>(tx.signature).s.size() >= tei.ins.size())
|
||||
tei.ins.back().multisig_count = boost::get<NLSAG_sig>(tx.signature).s[tei.ins.size() - 1].size();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -832,10 +832,11 @@ void wallet2::accept_proposal(const crypto::hash& contract_id, uint64_t b_accept
|
|||
tdb.m_flags &= ~(WALLET_TRANSFER_DETAIL_FLAG_SPENT);
|
||||
//---------------------------------
|
||||
//figure out fee that was left for release contract
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(tx.vout[n].amount > (contr_it->second.private_detailes.amount_to_pay +
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(tx.vout[n].type() == typeid(tx_out_bare), "Unexpected output type in accept proposal");
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(boost::get<tx_out_bare>(tx.vout[n]).amount > (contr_it->second.private_detailes.amount_to_pay +
|
||||
contr_it->second.private_detailes.amount_b_pledge +
|
||||
contr_it->second.private_detailes.amount_a_pledge), "THere is no left money for fee, contract_id: " << contract_id);
|
||||
uint64_t left_for_fee_in_multisig = tx.vout[n].amount - (contr_it->second.private_detailes.amount_to_pay +
|
||||
uint64_t left_for_fee_in_multisig = boost::get<tx_out_bare>(tx.vout[n]).amount - (contr_it->second.private_detailes.amount_to_pay +
|
||||
contr_it->second.private_detailes.amount_b_pledge +
|
||||
contr_it->second.private_detailes.amount_a_pledge);
|
||||
|
||||
|
|
@ -1400,7 +1401,8 @@ void wallet2::unprocess_htlc_triggers_on_block_removed(uint64_t height)
|
|||
tr.m_spent_height = 0;
|
||||
}
|
||||
//re-add to active contracts
|
||||
auto pair_key = std::make_pair(tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index].amount, tr.m_global_output_index);
|
||||
THROW_IF_FALSE_WALLET_EX(tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index].type() == typeid(tx_out_bare), "Unexprected type of out in unprocess_htlc_triggers_on_block_removed : " << tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index].type().name());
|
||||
auto pair_key = std::make_pair(boost::get<tx_out_bare>(tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index]).amount, tr.m_global_output_index);
|
||||
auto it_active_htlc = m_active_htlcs.find(pair_key);
|
||||
if (it_active_htlc != m_active_htlcs.end())
|
||||
{
|
||||
|
|
@ -1462,7 +1464,10 @@ void wallet2::process_htlc_triggers_on_block_added(uint64_t height)
|
|||
m_found_free_amounts.clear();
|
||||
|
||||
//remove it from active contracts
|
||||
auto it_active_htlc = m_active_htlcs.find(std::make_pair(tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index].amount, tr.m_global_output_index));
|
||||
CHECK_AND_ASSERT_MES(tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index].type() == typeid(tx_out_bare), void(), "Unexpected type out in process_htlc_triggers_on_block_added: " << tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index].type().name());
|
||||
uint64_t amount = boost::get<tx_out_bare>(tr.m_ptx_wallet_info->m_tx.vout[tr.m_internal_output_index]).amount;
|
||||
|
||||
auto it_active_htlc = m_active_htlcs.find(std::make_pair(, tr.m_global_output_index));
|
||||
if (it_active_htlc == m_active_htlcs.end())
|
||||
{
|
||||
LOG_ERROR("Erasing active htlc(m_active_htlcs), but it seems to be already erased");
|
||||
|
|
@ -2158,7 +2163,8 @@ bool wallet2::scan_unconfirmed_outdate_tx()
|
|||
if (t.m_flags&WALLET_TRANSFER_DETAIL_FLAG_SPENT
|
||||
&& !t.m_spent_height
|
||||
&& !static_cast<bool>(t.m_flags&WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION)
|
||||
&& t.m_ptx_wallet_info->m_tx.vout[t.m_internal_output_index].target.type() != typeid(txout_htlc)
|
||||
&& t.m_ptx_wallet_info->m_tx.vout[t.m_internal_output_index].type() == typeid(tx_out_bare)
|
||||
&& boost::get<tx_out_bare>(t.m_ptx_wallet_info->m_tx.vout[t.m_internal_output_index]).target.type() != typeid(txout_htlc)
|
||||
)
|
||||
{
|
||||
//check if there is unconfirmed for this transfer is no longer exist?
|
||||
|
|
@ -2331,10 +2337,11 @@ void wallet2::detach_blockchain(uint64_t including_height)
|
|||
for (size_t i = i_start; i != m_transfers.size(); i++)
|
||||
{
|
||||
//check for htlc
|
||||
if (m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index].target.type() == typeid(txout_htlc))
|
||||
if (m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index].type() == typeid(tx_out_bare) &&
|
||||
boost::get<tx_out_bare>(m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index]).target.type() == typeid(txout_htlc))
|
||||
{
|
||||
//need to find an entry in m_htlc and remove it
|
||||
const txout_htlc& hltc = boost::get<txout_htlc>(m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index].target);
|
||||
const txout_htlc& hltc = boost::get<txout_htlc>(boost::get<tx_out_bare>(m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index]).target);
|
||||
uint64_t expiration_height = m_transfers[i].m_ptx_wallet_info->m_block_height + hltc.expiration;
|
||||
auto pair_of_it = m_htlcs.equal_range(expiration_height);
|
||||
bool found = false;
|
||||
|
|
@ -2900,7 +2907,9 @@ void wallet2::store_watch_only(const std::wstring& path_to_save, const std::stri
|
|||
if (!td.is_spent())
|
||||
continue; // only spent transfers really need to be stored, because watch-only wallet will not be able to figure out they were spent otherwise
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(td.m_internal_output_index < td.m_ptx_wallet_info->m_tx.vout.size(), "invalid transfer #" << ti);
|
||||
const currency::txout_target_v& out_t = td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target;
|
||||
if(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].type() != typeid(tx_out_bare))
|
||||
continue;
|
||||
const currency::txout_target_v& out_t = boost::get<tx_out_bare>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]).target;
|
||||
if (out_t.type() != typeid(currency::txout_to_key))
|
||||
continue;
|
||||
const crypto::public_key& out_key = boost::get<txout_to_key>(out_t).key;
|
||||
|
|
@ -3083,28 +3092,34 @@ void wallet2::sign_transfer(const std::string& tx_sources_blob, std::string& sig
|
|||
|
||||
for (size_t i = 0; i < ft.tx.vout.size(); ++i)
|
||||
{
|
||||
const auto& out = ft.tx.vout[i];
|
||||
if (out.target.type() != typeid(txout_to_key))
|
||||
continue;
|
||||
const txout_to_key& otk = boost::get<txout_to_key>(out.target);
|
||||
|
||||
crypto::public_key ephemeral_pub = AUTO_VAL_INIT(ephemeral_pub);
|
||||
if (!crypto::derive_public_key(derivation, i, m_account.get_keys().account_address.spend_public_key, ephemeral_pub))
|
||||
VARIANT_SWITCH_BEGIN(ft.tx.vout[i]);
|
||||
VARIANT_CASE(tx_out_bare, out)
|
||||
{
|
||||
WLT_LOG_ERROR("derive_public_key failed for tx " << get_transaction_hash(ft.tx) << ", out # " << i);
|
||||
}
|
||||
if (out.target.type() != typeid(txout_to_key))
|
||||
continue;
|
||||
const txout_to_key& otk = boost::get<txout_to_key>(out.target);
|
||||
|
||||
if (otk.key == ephemeral_pub)
|
||||
{
|
||||
// this is the output to the given keys
|
||||
// derive secret key and calculate key image
|
||||
crypto::secret_key ephemeral_sec = AUTO_VAL_INIT(ephemeral_sec);
|
||||
crypto::derive_secret_key(derivation, i, m_account.get_keys().spend_secret_key, ephemeral_sec);
|
||||
crypto::key_image ki = AUTO_VAL_INIT(ki);
|
||||
crypto::generate_key_image(ephemeral_pub, ephemeral_sec, ki);
|
||||
crypto::public_key ephemeral_pub = AUTO_VAL_INIT(ephemeral_pub);
|
||||
if (!crypto::derive_public_key(derivation, i, m_account.get_keys().account_address.spend_public_key, ephemeral_pub))
|
||||
{
|
||||
WLT_LOG_ERROR("derive_public_key failed for tx " << get_transaction_hash(ft.tx) << ", out # " << i);
|
||||
}
|
||||
|
||||
ft.outs_key_images.push_back(make_serializable_pair(static_cast<uint64_t>(i), ki));
|
||||
if (otk.key == ephemeral_pub)
|
||||
{
|
||||
// this is the output to the given keys
|
||||
// derive secret key and calculate key image
|
||||
crypto::secret_key ephemeral_sec = AUTO_VAL_INIT(ephemeral_sec);
|
||||
crypto::derive_secret_key(derivation, i, m_account.get_keys().spend_secret_key, ephemeral_sec);
|
||||
crypto::key_image ki = AUTO_VAL_INIT(ki);
|
||||
crypto::generate_key_image(ephemeral_pub, ephemeral_sec, ki);
|
||||
|
||||
ft.outs_key_images.push_back(make_serializable_pair(static_cast<uint64_t>(i), ki));
|
||||
}
|
||||
}
|
||||
VARIANT_CASE_TV(tx_out_zarcanum);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
}
|
||||
|
||||
// serialize and encrypt the result
|
||||
|
|
@ -3175,7 +3190,8 @@ void wallet2::submit_transfer(const std::string& signed_tx_blob, currency::trans
|
|||
for (auto& p : ft.outs_key_images)
|
||||
{
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(p.first < tx.vout.size(), "outs_key_images has invalid out index: " << p.first << ", tx.vout.size() = " << tx.vout.size());
|
||||
auto& out = tx.vout[p.first];
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(tx.vout[p.first].type() == typeid(tx_out_bare), "Unexpected type in submit_transfer: " << tx.vout[p.first].type().name());
|
||||
auto& out = boost::get<tx_out_bare>(tx.vout[p.first]);
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(out.target.type() == typeid(txout_to_key), "outs_key_images has invalid out type, index: " << p.first);
|
||||
const txout_to_key& otk = boost::get<txout_to_key>(out.target);
|
||||
pk_ki_to_be_added.push_back(std::make_pair(otk.key, p.second));
|
||||
|
|
@ -3643,7 +3659,12 @@ bool wallet2::build_minted_block(const currency::COMMAND_RPC_SCAN_POS::request&
|
|||
WLT_CHECK_AND_ASSERT_MES(req.pos_entries[rsp.index].wallet_index < m_transfers.size(),
|
||||
false, "Wrong wallet_index at generating coinbase transacton");
|
||||
|
||||
const auto& target = m_transfers[req.pos_entries[rsp.index].wallet_index].m_ptx_wallet_info->m_tx.vout[m_transfers[req.pos_entries[rsp.index].wallet_index].m_internal_output_index].target;
|
||||
if (m_transfers[req.pos_entries[rsp.index].wallet_index].m_ptx_wallet_info->m_tx.vout[m_transfers[req.pos_entries[rsp.index].wallet_index].m_internal_output_index].type() != typeid(tx_out_bare))
|
||||
{
|
||||
//@#@ review zarcanum here
|
||||
return false;
|
||||
}
|
||||
const auto& target = boost::get<tx_out_bare>(m_transfers[req.pos_entries[rsp.index].wallet_index].m_ptx_wallet_info->m_tx.vout[m_transfers[req.pos_entries[rsp.index].wallet_index].m_internal_output_index]).target;
|
||||
WLT_CHECK_AND_ASSERT_MES(target.type() == typeid(currency::txout_to_key), false, "wrong type_id in source transaction in coinbase tx");
|
||||
|
||||
const currency::txout_to_key& txtokey = boost::get<currency::txout_to_key>(target);
|
||||
|
|
@ -4312,10 +4333,17 @@ void wallet2::get_list_of_active_htlc(std::list<wallet_public::htlc_entry_info>&
|
|||
}
|
||||
wallet_public::htlc_entry_info entry = AUTO_VAL_INIT(entry);
|
||||
entry.tx_id = htlc_entry.first;
|
||||
entry.amount = td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].amount;
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target.type() == typeid(txout_htlc),
|
||||
if (td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].type() != typeid(tx_out_bare))
|
||||
{
|
||||
//@#@
|
||||
LOG_ERROR("Unexpected output type in get_list_of_active_htlc:" << td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].type().name());
|
||||
continue;
|
||||
}
|
||||
const tx_out_bare out_b = boost::get<tx_out_bare>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]);
|
||||
entry.amount = out_b.amount;
|
||||
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(out_b.target.type() == typeid(txout_htlc),
|
||||
"[get_list_of_active_htlc]Internal error: unexpected type of out");
|
||||
const txout_htlc& htlc = boost::get<txout_htlc>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target);
|
||||
const txout_htlc& htlc = boost::get<txout_htlc>(out_b.target);
|
||||
entry.sha256_hash = htlc.htlc_hash;
|
||||
|
||||
currency::tx_payer payer = AUTO_VAL_INIT(payer);
|
||||
|
|
@ -4510,26 +4538,33 @@ bool wallet2::prepare_tx_sources(size_t fake_outputs_count, std::vector<currency
|
|||
//size_t real_index = src.outputs.size() ? (rand() % src.outputs.size() ):0;
|
||||
tx_output_entry real_oe;
|
||||
real_oe.first = td.m_global_output_index; // TODO: use ref_by_id when neccessary
|
||||
if (td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target.type() == typeid(txout_to_key))
|
||||
//@#@
|
||||
VARIANT_SWITCH_BEGIN(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]);
|
||||
VARIANT_CASE(tx_out_bare, o)
|
||||
{
|
||||
real_oe.second = boost::get<txout_to_key>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target).key;
|
||||
}
|
||||
else if (td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target.type() == typeid(txout_htlc))
|
||||
{
|
||||
real_oe.second = boost::get<txout_htlc>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target).pkey_refund;
|
||||
}
|
||||
else
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WITH_CODE(false,
|
||||
"Internal error: unexpected type of target: " << td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target.type().name(),
|
||||
API_RETURN_CODE_INTERNAL_ERROR);
|
||||
}
|
||||
VARIANT_SWITCH_BEGIN(o);
|
||||
VARIANT_CASE(txout_to_key, o)
|
||||
real_oe.second = o.key;
|
||||
VARIANT_CASE(txout_htlc, htlc)
|
||||
real_oe.second = htlc.pkey_refund;
|
||||
VARIANT_CASE_OTHER()
|
||||
{
|
||||
WLT_THROW_IF_FALSE_WITH_CODE(false,
|
||||
"Internal error: unexpected type of target: " << o.target.type().name(),
|
||||
API_RETURN_CODE_INTERNAL_ERROR);
|
||||
}
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
auto interted_it = src.outputs.insert(it_to_insert, real_oe);
|
||||
src.real_out_tx_key = get_tx_pub_key_from_extra(td.m_ptx_wallet_info->m_tx);
|
||||
src.real_output = interted_it - src.outputs.begin();
|
||||
src.real_output_in_tx_index = td.m_internal_output_index;
|
||||
print_source_entry(src);
|
||||
auto interted_it = src.outputs.insert(it_to_insert, real_oe);
|
||||
src.real_out_tx_key = get_tx_pub_key_from_extra(td.m_ptx_wallet_info->m_tx);
|
||||
src.real_output = interted_it - src.outputs.begin();
|
||||
src.real_output_in_tx_index = td.m_internal_output_index;
|
||||
print_source_entry(src);
|
||||
}
|
||||
VARIANT_CASE_TV(tx_out_zarcanum);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
++i;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -4542,7 +4577,9 @@ bool wallet2::prepare_tx_sources(crypto::hash multisig_id, std::vector<currency:
|
|||
THROW_IF_FALSE_WALLET_INT_ERR_EX(!it->second.is_spent(), "output with multisig_id: " + epee::string_tools::pod_to_hex(multisig_id) + " has already been spent by other party at height " + epee::string_tools::num_to_string_fast(it->second.m_spent_height));
|
||||
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(it->second.m_internal_output_index < it->second.m_ptx_wallet_info->m_tx.vout.size(), "it->second.m_internal_output_index < it->second.m_tx.vout.size()");
|
||||
const tx_out_bare& out = it->second.m_ptx_wallet_info->m_tx.vout[it->second.m_internal_output_index];
|
||||
//@#@
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(it->second.m_ptx_wallet_info->m_tx.vout[it->second.m_internal_output_index].type() == typeid(tx_out_bare), "Unknown type id in prepare_tx_sources: " << it->second.m_ptx_wallet_info->m_tx.vout[it->second.m_internal_output_index].type().name());
|
||||
const tx_out_bare& out = boost::get<tx_out_bare>(it->second.m_ptx_wallet_info->m_tx.vout[it->second.m_internal_output_index]);
|
||||
THROW_IF_FALSE_WALLET_INT_ERR_EX(out.target.type() == typeid(txout_multisig), "ms out target type is " << out.target.type().name() << ", expected: txout_multisig");
|
||||
const txout_multisig& ms_out = boost::get<txout_multisig>(out.target);
|
||||
|
||||
|
|
@ -4571,11 +4608,16 @@ bool wallet2::prepare_tx_sources_htlc(crypto::hash htlc_tx_id, const std::string
|
|||
WLT_THROW_IF_FALSE_WITH_CODE(m_transfers.size() > it->second,
|
||||
"Internal error: index in m_active_htlcs_txid <" << it->second << "> is bigger then size of m_transfers <" << m_transfers.size() << ">", API_RETURN_CODE_INTERNAL_ERROR);
|
||||
|
||||
//@#@
|
||||
WLT_THROW_IF_FALSE_WITH_CODE(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].type() == typeid(tx_out_bare),
|
||||
"Unexpected out type in prepare_tx_sources_htlc:" << td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].type().name());
|
||||
|
||||
const tx_out_bare& out_bare = boost::get<tx_out_bare>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]);
|
||||
const transfer_details& td = m_transfers[it->second];
|
||||
WLT_THROW_IF_FALSE_WITH_CODE(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target.type() == typeid(txout_htlc),
|
||||
WLT_THROW_IF_FALSE_WITH_CODE(out_bare.target.type() == typeid(txout_htlc),
|
||||
"Unexpected type in active htlc", API_RETURN_CODE_INTERNAL_ERROR);
|
||||
|
||||
const txout_htlc& htlc_out = boost::get<txout_htlc>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target);
|
||||
const txout_htlc& htlc_out = boost::get<txout_htlc>(out_bare.target);
|
||||
bool use_sha256 = !(htlc_out.flags&CURRENCY_TXOUT_HTLC_FLAGS_HASH_TYPE_MASK);
|
||||
|
||||
//check origin
|
||||
|
|
@ -4958,18 +5000,23 @@ bool wallet2::is_transfer_able_to_go(const transfer_details& td, uint64_t fake_o
|
|||
{
|
||||
if (!td.is_spendable())
|
||||
return false;
|
||||
|
||||
if (td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target.type() == typeid(txout_htlc))
|
||||
VARIANT_SWITCH_BEGIN(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]);
|
||||
VARIANT_CASE(tx_out_bare, o);
|
||||
{
|
||||
if (fake_outputs_count != 0)
|
||||
return false;
|
||||
if (o.target.type() == typeid(txout_htlc))
|
||||
{
|
||||
if (fake_outputs_count != 0)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currency::is_mixattr_applicable_for_fake_outs_counter(boost::get<currency::txout_to_key>(o.target).mix_attr, fake_outputs_count))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currency::is_mixattr_applicable_for_fake_outs_counter(boost::get<currency::txout_to_key>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target).mix_attr, fake_outputs_count))
|
||||
return false;
|
||||
}
|
||||
|
||||
VARIANT_CASE_TV(tx_out_zarcanum);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
|
@ -4985,7 +5032,8 @@ bool wallet2::prepare_free_transfers_cache(uint64_t fake_outputs_count)
|
|||
const transfer_details& td = m_transfers[i];
|
||||
if (is_transfer_able_to_go(td, fake_outputs_count))
|
||||
{
|
||||
m_found_free_amounts[td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].amount].insert(i);
|
||||
//@#@
|
||||
boost::get<tx_out_bare>(m_found_free_amounts[td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].amount]).insert(i);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -4998,8 +5046,9 @@ bool wallet2::prepare_free_transfers_cache(uint64_t fake_outputs_count)
|
|||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::add_transfers_to_transfers_cache(const std::vector<uint64_t>& indexs)
|
||||
{
|
||||
//@#@
|
||||
for (auto i : indexs)
|
||||
add_transfer_to_transfers_cache(m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index].amount , i);
|
||||
add_transfer_to_transfers_cache(boost::get<tx_out_bare>(m_transfers[i].m_ptx_wallet_info->m_tx.vout[m_transfers[i].m_internal_output_index]).amount , i);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::add_transfer_to_transfers_cache(uint64_t amount, uint64_t index)
|
||||
|
|
@ -5668,7 +5717,11 @@ void wallet2::sweep_below(size_t fake_outs_count, const currency::account_public
|
|||
});
|
||||
tx_output_entry real_oe;
|
||||
real_oe.first = td.m_global_output_index;
|
||||
real_oe.second = boost::get<txout_to_key>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].target).key;
|
||||
//@#@
|
||||
if(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index].type() != typeid(tx_out_bare))
|
||||
continue;
|
||||
const tx_out_bare& out_b = boost::get<tx_out_bare>(td.m_ptx_wallet_info->m_tx.vout[td.m_internal_output_index]);
|
||||
real_oe.second = boost::get<txout_to_key>(out_b.target).key;
|
||||
auto inserted_it = src.outputs.insert(it_to_insert, real_oe);
|
||||
src.real_out_tx_key = get_tx_pub_key_from_extra(td.m_ptx_wallet_info->m_tx);
|
||||
src.real_output = inserted_it - src.outputs.begin();
|
||||
|
|
|
|||
|
|
@ -884,8 +884,8 @@ bool gen_alias_reg_with_locked_money::generate(std::vector<test_event_entry>& ev
|
|||
ai.m_address = miner_acc.get_public_address();
|
||||
|
||||
currency::tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = blk_0.miner_tx.vout[0].amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<currency::txout_to_key>(blk_0.miner_tx.vout[0].target).key));
|
||||
se.amount = blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<currency::txout_to_key>(blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).target).key));
|
||||
se.real_output = 0;
|
||||
se.real_output_in_tx_index = 0;
|
||||
se.real_out_tx_key = currency::get_tx_pub_key_from_extra(blk_0.miner_tx);
|
||||
|
|
@ -1159,8 +1159,8 @@ bool gen_alias_tx_no_outs::generate(std::vector<test_event_entry>& events) const
|
|||
ai.m_address = miner_acc.get_public_address();
|
||||
|
||||
currency::tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = blk_0.miner_tx.vout[0].amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<currency::txout_to_key>(blk_0.miner_tx.vout[0].target).key));
|
||||
se.amount = blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<currency::txout_to_key>(blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).target).key));
|
||||
se.real_output = 0;
|
||||
se.real_output_in_tx_index = 0;
|
||||
se.real_out_tx_key = currency::get_tx_pub_key_from_extra(blk_0.miner_tx);
|
||||
|
|
|
|||
|
|
@ -59,9 +59,9 @@ bool block_template_against_txs_size::c1(currency::core& c, size_t ev_index, con
|
|||
keypair ephemeral = AUTO_VAL_INIT(ephemeral);
|
||||
r = generate_key_image_helper(miner_acc.get_keys(), get_tx_pub_key_from_extra(blk_0.miner_tx), 0, ephemeral, ki);
|
||||
CHECK_AND_ASSERT_MES(r, false, "generate_key_image_helper failed");
|
||||
CHECK_AND_ASSERT_MES(boost::get<txout_to_key>(blk_0.miner_tx.vout[0].target).key == ephemeral.pub, false, "ephemeral.pub doesn't match with output key");
|
||||
CHECK_AND_ASSERT_MES(boost::get<txout_to_key>(blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).target).key == ephemeral.pub, false, "ephemeral.pub doesn't match with output key");
|
||||
pos_entry pe = AUTO_VAL_INIT(pe);
|
||||
pe.amount = blk_0.miner_tx.vout[0].amount;
|
||||
pe.amount = blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).amount;
|
||||
pe.block_timestamp = UINT64_MAX; // doesn't matter
|
||||
pe.index = 0; // global index
|
||||
pe.keyimage = ki;
|
||||
|
|
|
|||
|
|
@ -311,8 +311,8 @@ bool gen_block_miner_tx_has_2_in::generate(std::vector<test_event_entry>& events
|
|||
GENERATE_ACCOUNT(alice);
|
||||
|
||||
tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = blk_0.miner_tx.vout[0].amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<txout_to_key>(blk_0.miner_tx.vout[0].target).key));
|
||||
se.amount = blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<txout_to_key>(blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).target).key));
|
||||
se.real_output = 0;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(blk_0.miner_tx);
|
||||
se.real_output_in_tx_index = 0;
|
||||
|
|
@ -356,8 +356,8 @@ bool gen_block_miner_tx_with_txin_to_key::generate(std::vector<test_event_entry>
|
|||
REWIND_BLOCKS(events, blk_1r, blk_1, miner_account);
|
||||
|
||||
tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = blk_1.miner_tx.vout[0].amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<txout_to_key>(blk_1.miner_tx.vout[0].target).key));
|
||||
se.amount = blk_1.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<txout_to_key>(blk_1.boost::get<currency::tx_out_bare>(miner_tx.vout[0]).target).key));
|
||||
se.real_output = 0;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(blk_1.miner_tx);
|
||||
se.real_output_in_tx_index = 0;
|
||||
|
|
@ -393,7 +393,7 @@ bool gen_block_miner_tx_out_is_small::generate(std::vector<test_event_entry>& ev
|
|||
BLOCK_VALIDATION_INIT_GENERATE();
|
||||
|
||||
MAKE_MINER_TX_MANUALLY(miner_tx, blk_0);
|
||||
miner_tx.vout[0].amount /= 2;
|
||||
boost::get<currency::tx_out_bare>( miner_tx.vout[0]).amount /= 2;
|
||||
|
||||
block blk_1;
|
||||
generator.construct_block_manually(blk_1, blk_0, miner_account, test_generator::bf_miner_tx, 0, 0, 0, crypto::hash(), 0, miner_tx);
|
||||
|
|
@ -409,7 +409,7 @@ bool gen_block_miner_tx_out_is_big::generate(std::vector<test_event_entry>& even
|
|||
BLOCK_VALIDATION_INIT_GENERATE();
|
||||
|
||||
MAKE_MINER_TX_MANUALLY(miner_tx, blk_0);
|
||||
miner_tx.vout[0].amount *= 2;
|
||||
boost::get<currency::tx_out_bare>( miner_tx.vout[0]).amount *= 2;
|
||||
|
||||
block blk_1;
|
||||
generator.construct_block_manually(blk_1, blk_0, miner_account, test_generator::bf_miner_tx, 0, 0, 0, crypto::hash(), 0, miner_tx);
|
||||
|
|
@ -451,8 +451,8 @@ bool gen_block_miner_tx_has_out_to_alice::generate(std::vector<test_event_entry>
|
|||
crypto::derive_public_key(derivation, 1, alice.get_keys().account_address.spend_public_key, out_eph_public_key);
|
||||
|
||||
tx_out_bare out_to_alice;
|
||||
out_to_alice.amount = miner_tx.vout[0].amount / 2;
|
||||
miner_tx.vout[0].amount -= out_to_alice.amount;
|
||||
out_to_alice.amount =boost::get<currency::tx_out_bare>( miner_tx.vout[0]).amount / 2;
|
||||
boost::get<currency::tx_out_bare>( miner_tx.vout[0]).amount -= out_to_alice.amount;
|
||||
out_to_alice.target = txout_to_key(out_eph_public_key);
|
||||
miner_tx.vout.push_back(out_to_alice);
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ bool gen_block_is_too_big::generate(std::vector<test_event_entry>& events) const
|
|||
uint64_t amount = get_outs_money_amount(miner_tx);
|
||||
uint64_t portion = amount / tx_out_count;
|
||||
uint64_t remainder = amount % tx_out_count;
|
||||
txout_target_v target = miner_tx.vout[0].target;
|
||||
txout_target_v target =boost::get<currency::tx_out_bare>( miner_tx.vout[0]).target;
|
||||
miner_tx.vout.clear();
|
||||
for (size_t i = 0; i < tx_out_count; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ bool gen_chain_switch_pow_pos::generate(std::vector<test_event_entry>& events) c
|
|||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(alice.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
|
|||
|
|
@ -620,8 +620,8 @@ bool test_generator::build_outputs_indext_for_chain(const blockchain_vector& blo
|
|||
std::vector<uint64_t>& coinbase_outs = txs_outs[currency::get_transaction_hash(blocks[h]->b.miner_tx)];
|
||||
for (size_t out_i = 0; out_i != blocks[h]->b.miner_tx.vout.size(); out_i++)
|
||||
{
|
||||
coinbase_outs.push_back(index[blocks[h]->b.miner_tx.vout[out_i].amount].size());
|
||||
index[blocks[h]->b.miner_tx.vout[out_i].amount].push_back(std::tuple<size_t, size_t, size_t>(h, 0, out_i));
|
||||
coinbase_outs.push_back(index[blocks[h]->b.boost::get<currency::tx_out_bare>(miner_tx.vout[out_i]).amount].size());
|
||||
index[blocks[h]->b.boost::get<currency::tx_out_bare>(miner_tx.vout[out_i]).amount].push_back(std::tuple<size_t, size_t, size_t>(h, 0, out_i));
|
||||
}
|
||||
|
||||
for (size_t tx_index = 0; tx_index != blocks[h]->m_transactions.size(); tx_index++)
|
||||
|
|
@ -629,8 +629,8 @@ bool test_generator::build_outputs_indext_for_chain(const blockchain_vector& blo
|
|||
std::vector<uint64_t>& tx_outs_indx = txs_outs[currency::get_transaction_hash(blocks[h]->m_transactions[tx_index])];
|
||||
for (size_t out_i = 0; out_i != blocks[h]->m_transactions[tx_index].vout.size(); out_i++)
|
||||
{
|
||||
tx_outs_indx.push_back(index[blocks[h]->m_transactions[tx_index].vout[out_i].amount].size());
|
||||
index[blocks[h]->m_transactions[tx_index].vout[out_i].amount].push_back(std::tuple<size_t, size_t, size_t>(h, tx_index + 1, out_i));
|
||||
tx_outs_indx.push_back(index[blocks[h]->m_transactions[tx_index]boost::get<currency::tx_out_bare>(.vout[out_i]).amount].size());
|
||||
index[blocks[h]->m_transactions[tx_index]boost::get<currency::tx_out_bare>(.vout[out_i]).amount].push_back(std::tuple<size_t, size_t, size_t>(h, tx_index + 1, out_i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -664,10 +664,10 @@ bool test_generator::get_output_details_by_global_index(const test_generator::bl
|
|||
|
||||
tx_pub_key = get_tx_pub_key_from_extra(*tx);
|
||||
CHECK_AND_ASSERT_THROW_MES(tx->vout[tx_out_index].target.type() == typeid(currency::txout_to_key),
|
||||
"blck_chain[h]->m_transactions[tx_index].vout[tx_out_index].target.type() == typeid(currency::txout_to_key)");
|
||||
"blck_chain[h]->m_transactions[tx_index]boost::get<currency::tx_out_bare>(.vout[tx_out_index]).target.type() == typeid(currency::txout_to_key)");
|
||||
|
||||
CHECK_AND_ASSERT_THROW_MES(tx->vout[tx_out_index].amount == amount,
|
||||
"blck_chain[h]->m_transactions[tx_index].vout[tx_out_index].amount == amount");
|
||||
"blck_chain[h]->m_transactions[tx_index]boost::get<currency::tx_out_bare>(.vout[tx_out_index]).amount == amount");
|
||||
|
||||
output_key = boost::get<currency::txout_to_key>(tx->vout[tx_out_index].target).key;
|
||||
return true;
|
||||
|
|
@ -1806,7 +1806,7 @@ bool find_global_index_for_output(const std::vector<test_event_entry>& events, c
|
|||
size_t get_tx_out_index_by_amount(const currency::transaction& tx, const uint64_t amount)
|
||||
{
|
||||
for (size_t i = 0; i < tx.vout.size(); ++i)
|
||||
if (tx.vout[i].amount == amount)
|
||||
if (boost::get<currency::tx_out_bare>(tx.vout[i]).amount == amount)
|
||||
return i;
|
||||
|
||||
return SIZE_MAX;
|
||||
|
|
@ -1827,14 +1827,14 @@ bool sign_multisig_input_in_tx_custom(currency::transaction& tx, size_t ms_input
|
|||
size_t ms_out_index = SIZE_MAX;
|
||||
for (size_t i = 0; i < source_tx.vout.size(); ++i)
|
||||
{
|
||||
if (source_tx.vout[i].target.type() == typeid(txout_multisig) && ms_in.multisig_out_id == get_multisig_out_id(source_tx, i))
|
||||
if (boost::get<currency::tx_out_bare>(source_tx.vout[i]).target.type() == typeid(txout_multisig) && ms_in.multisig_out_id == get_multisig_out_id(source_tx, i))
|
||||
{
|
||||
ms_out_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
LOC_CHK(ms_out_index != SIZE_MAX, "failed to find ms output in source tx " << get_transaction_hash(source_tx) << " by ms id " << ms_in.multisig_out_id);
|
||||
const txout_multisig& out_ms = boost::get<txout_multisig>(source_tx.vout[ms_out_index].target);
|
||||
const txout_multisig& out_ms = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(source_tx.vout[ms_out_index]).target);
|
||||
|
||||
crypto::public_key source_tx_pub_key = get_tx_pub_key_from_extra(source_tx);
|
||||
|
||||
|
|
@ -1904,11 +1904,11 @@ bool make_tx_multisig_to_key(const currency::transaction& source_tx,
|
|||
CHECK_AND_ASSERT_MES(source_tx_out_idx < source_tx.vout.size(), false, "tx " << se.real_output << " has " << source_tx.vout.size() << " outputs, #" << source_tx_out_idx << " specified");
|
||||
se.real_output_in_tx_index = source_tx_out_idx;
|
||||
se.multisig_id = get_multisig_out_id(source_tx, se.real_output_in_tx_index);
|
||||
CHECK_AND_ASSERT_MES(source_tx.vout[se.real_output_in_tx_index].target.type() == typeid(txout_multisig), false, "tx " << se.real_output << " output #" << source_tx_out_idx << " is not a txout_multisig");
|
||||
const txout_multisig& ms_out = boost::get<txout_multisig>(source_tx.vout[se.real_output_in_tx_index].target);
|
||||
CHECK_AND_ASSERT_MES(boost::get<currency::tx_out_bare>(source_tx.vout[se.real_output_in_tx_index]).target.type() == typeid(txout_multisig), false, "tx " << se.real_output << " output #" << source_tx_out_idx << " is not a txout_multisig");
|
||||
const txout_multisig& ms_out = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(source_tx.vout[se.real_output_in_tx_index]).target);
|
||||
se.ms_keys_count = ms_out.keys.size();
|
||||
se.ms_sigs_count = ms_out.minimum_sigs;
|
||||
se.amount = source_tx.vout[se.real_output_in_tx_index].amount;
|
||||
se.amount =boost::get<currency::tx_out_bare>( source_tx.vout[se.real_output_in_tx_index]).amount;
|
||||
|
||||
tx_destination_entry de(se.amount - fee, target_address);
|
||||
|
||||
|
|
@ -2002,11 +2002,11 @@ bool generate_pos_block_with_given_coinstake(test_generator& generator, const st
|
|||
bool r = find_global_index_for_output(events, prev_id, stake_tx, stake_output_idx, stake_output_gidx);
|
||||
CHECK_AND_ASSERT_MES(r, false, "find_global_index_for_output failed");
|
||||
}
|
||||
uint64_t stake_output_amount = stake_tx.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake_tx.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake_tx.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake_tx.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
|
|||
|
|
@ -552,11 +552,11 @@ bool gen_checkpoints_pos_validation_on_altchain::generate(std::vector<test_event
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -581,11 +581,11 @@ bool gen_checkpoints_pos_validation_on_altchain::generate(std::vector<test_event
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
//crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
//crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ bool gen_double_spend_in_tx<txs_kept_by_block>::generate(std::vector<test_event_
|
|||
uint64_t global_out_index = 0;
|
||||
bool r = find_global_index_for_output(events, get_block_hash(blk_1r), tx_0, se.real_output_in_tx_index, global_out_index);
|
||||
CHECK_AND_ASSERT_MES(r, false, "find_global_index_for_output failed");
|
||||
se.outputs.push_back(make_serializable_pair<currency::txout_ref_v, crypto::public_key>(global_out_index, boost::get<currency::txout_to_key>(tx_0.vout[se.real_output_in_tx_index].target).key));
|
||||
se.outputs.push_back(make_serializable_pair<currency::txout_ref_v, crypto::public_key>(global_out_index, boost::get<currency::txout_to_key>(boost::get<currency::tx_out_bare>(tx_0.vout[se.real_output_in_tx_index]).target).key));
|
||||
se.real_output = 0;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_0);
|
||||
sources.push_back(se);
|
||||
|
|
|
|||
|
|
@ -98,11 +98,11 @@ bool emission_test::c1(currency::core& c, size_t ev_index, const std::vector<tes
|
|||
const transaction& stake = tce_ptr->tx;
|
||||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_gidx = tce_ptr->m_global_output_indexes[stake_output_idx];
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(m_miner_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
difficulty = c.get_blockchain_storage().get_next_diff_conditional(true);
|
||||
//size_t median_size = 0; // little hack: we're using small blocks (only coinbase tx), so we're in CURRENCY_BLOCK_GRANTED_FULL_REWARD_ZONE - don't need to calc median size
|
||||
|
|
|
|||
|
|
@ -338,11 +338,11 @@ inline bool build_custom_escrow_release_template(
|
|||
// inputs
|
||||
// create multisig (A-B) source, add keys from B
|
||||
tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = (~custom_config_mask & eccf_rel_template_inv_ms_amount) ? escrow_template_tx.vout[ms_idx].amount : escrow_template_tx.vout[ms_idx].amount + 10 * TESTS_DEFAULT_FEE;
|
||||
se.amount = (~custom_config_mask & eccf_rel_template_inv_ms_amount) ?boost::get<currency::tx_out_bare>( escrow_template_tx.vout[ms_idx]).amount :boost::get<currency::tx_out_bare>( escrow_template_tx.vout[ms_idx]).amount + 10 * TESTS_DEFAULT_FEE;
|
||||
se.multisig_id = ms_id;
|
||||
se.real_output_in_tx_index = ms_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(escrow_template_tx);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(escrow_template_tx.vout[ms_idx].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(escrow_template_tx.vout[ms_idx]).target).keys.size();
|
||||
se.ms_sigs_count = (~custom_config_mask & eccf_rel_template_inv_sigs_count) ? 2 : 1;
|
||||
std::vector<tx_source_entry> sources({ se });
|
||||
|
||||
|
|
|
|||
|
|
@ -390,11 +390,11 @@ bool hard_fork_1_checkpoint_basic_test::generate(std::vector<test_event_entry>&
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(stakeholder.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -566,11 +566,11 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(alice_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -605,11 +605,11 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(alice_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -653,11 +653,11 @@ bool hard_fork_1_pos_and_locked_coins::generate(std::vector<test_event_entry>& e
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(bob_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -750,11 +750,11 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(stakeholder.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -795,11 +795,11 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(stakeholder.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -839,11 +839,11 @@ bool hard_fork_1_pos_locked_height_vs_time::generate(std::vector<test_event_entr
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(stakeholder.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace
|
|||
{
|
||||
uint64_t total_amount = get_outs_money_amount(miner_tx);
|
||||
uint64_t amount_2 = total_amount - amount_1;
|
||||
txout_target_v target = miner_tx.vout[0].target;
|
||||
txout_target_v target =boost::get<currency::tx_out_bare>( miner_tx.vout[0]).target;
|
||||
|
||||
miner_tx.vout.clear();
|
||||
|
||||
|
|
@ -39,8 +39,8 @@ namespace
|
|||
void append_tx_source_entry(std::vector<currency::tx_source_entry>& sources, const transaction& tx, size_t out_idx)
|
||||
{
|
||||
currency::tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = tx.vout[out_idx].amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<currency::txout_to_key>(tx.vout[out_idx].target).key));
|
||||
se.amount =boost::get<currency::tx_out_bare>( tx.vout[out_idx]).amount;
|
||||
se.outputs.push_back(make_serializable_pair<txout_ref_v, crypto::public_key>(0, boost::get<currency::txout_to_key>(boost::get<currency::tx_out_bare>(tx.vout[out_idx]).target).key));
|
||||
se.real_output = 0;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx);
|
||||
se.real_output_in_tx_index = out_idx;
|
||||
|
|
@ -134,7 +134,7 @@ bool gen_uint_overflow_2::generate(std::vector<test_event_entry>& events) const
|
|||
std::vector<currency::tx_source_entry> sources;
|
||||
for (size_t i = 0; i < blk_0.miner_tx.vout.size(); ++i)
|
||||
{
|
||||
if (TESTS_DEFAULT_FEE < blk_0.miner_tx.vout[i].amount)
|
||||
if (TESTS_DEFAULT_FEE < blk_0.boost::get<currency::tx_out_bare>(miner_tx.vout[i]).amount)
|
||||
{
|
||||
append_tx_source_entry(sources, blk_0.miner_tx, i);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ bool block_template_vs_invalid_txs_from_pool::generate(std::vector<test_event_en
|
|||
se.multisig_id = get_multisig_out_id(tx_1m, 0);
|
||||
se.real_output_in_tx_index = 0;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1m);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1m.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1m.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
transaction tx_2m = AUTO_VAL_INIT(tx_2m);
|
||||
r = construct_tx(bob_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, miner_acc.get_public_address()) }),
|
||||
|
|
@ -447,8 +447,8 @@ bool test_blockchain_vs_spent_multisig_outs::generate(std::vector<test_event_ent
|
|||
// tx_1: txin_multisig -> txout_to_key
|
||||
size_t ms_out_idx = 0;
|
||||
tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = tx_0.vout[ms_out_idx].amount;
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_0.vout[ms_out_idx].target).keys.size();
|
||||
se.amount =boost::get<currency::tx_out_bare>( tx_0.vout[ms_out_idx]).amount;
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_0.vout[ms_out_idx]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
se.multisig_id = get_multisig_out_id(tx_0, ms_out_idx);
|
||||
se.real_output_in_tx_index = ms_out_idx;
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ bool multisig_wallet_test::c1(currency::core& c, size_t ev_index, const std::vec
|
|||
size_t i = 0;
|
||||
for (; i != result_tx.vout.size(); i++)
|
||||
{
|
||||
if (result_tx.vout[i].target.type() == typeid(txout_multisig))
|
||||
if (boost::get<currency::tx_out_bare>(result_tx.vout[i]).target.type() == typeid(txout_multisig))
|
||||
break;
|
||||
}
|
||||
CHECK_AND_ASSERT_MES(i != result_tx.vout.size(), false, "Incorrect txs outs");
|
||||
|
|
@ -906,7 +906,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = ms_id;
|
||||
se.real_output_in_tx_index = ms_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 2;
|
||||
|
||||
tx_destination_entry de(se.amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
|
@ -939,7 +939,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = ms_id;
|
||||
se.real_output_in_tx_index = ms_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 2;
|
||||
|
||||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
|
|
@ -976,7 +976,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = ms_4_id;
|
||||
se.real_output_in_tx_index = ms_4_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_4);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_4.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_4.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 3;
|
||||
|
||||
transaction tx_5 = AUTO_VAL_INIT(tx_5);
|
||||
|
|
@ -1020,7 +1020,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = ms_6_id;
|
||||
se.real_output_in_tx_index = ms_6_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_6);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_6.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_6.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 4;
|
||||
|
||||
transaction tx_7 = AUTO_VAL_INIT(tx_7);
|
||||
|
|
@ -1062,7 +1062,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = ms_8_id;
|
||||
se.real_output_in_tx_index = ms_8_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_8);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_8.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_8.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
static const size_t redundant_keys_count = 7000;
|
||||
se.ms_sigs_count = redundant_keys_count;
|
||||
|
||||
|
|
@ -1138,7 +1138,7 @@ bool multisig_and_fake_outputs::generate(std::vector<test_event_entry>& events)
|
|||
// Second, correctly set up multisig part
|
||||
tx_source_entry& se = sources.back();
|
||||
se.multisig_id = tx_1_ms_out_id;
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[tx_1_ms_out_idx].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[tx_1_ms_out_idx]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
se.real_output_in_tx_index = tx_1_ms_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
|
|
@ -1217,7 +1217,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
se.multisig_id = tx_1_ms_out_id;
|
||||
se.real_output_in_tx_index = tx_1_ms_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[tx_1_ms_out_idx].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[tx_1_ms_out_idx]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
sources.assign({ se });
|
||||
|
||||
|
|
@ -1295,7 +1295,7 @@ bool multisig_and_unlock_time::generate(std::vector<test_event_entry>& events) c
|
|||
se.multisig_id = tx_5_ms_out_id;
|
||||
se.real_output_in_tx_index = tx_5_ms_out_idx;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_5);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_5.vout[tx_5_ms_out_idx].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_5.vout[tx_5_ms_out_idx]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
sources.assign({ se });
|
||||
|
||||
|
|
@ -1351,11 +1351,11 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
keypair tx_key = keypair::generate();
|
||||
|
||||
pos_block_builder pb;
|
||||
|
|
@ -1411,7 +1411,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = get_multisig_out_id(blk_1.miner_tx, se.real_output_in_tx_index);
|
||||
//se.participants.push_back(alice_acc.get_keys());
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(blk_1.miner_tx);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(blk_1.miner_tx.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(blk_1.boost::get<currency::tx_out_bare>(miner_tx.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
sources.assign({ se });
|
||||
|
||||
|
|
@ -1477,7 +1477,7 @@ bool multisig_and_coinbase::generate(std::vector<test_event_entry>& events) cons
|
|||
se.multisig_id = get_multisig_out_id(blk_3.miner_tx, 0);
|
||||
se.real_output_in_tx_index = 0;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(blk_3.miner_tx);
|
||||
se.ms_keys_count= boost::get<txout_multisig>(blk_3.miner_tx.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count= boost::get<txout_multisig>(blk_3.boost::get<currency::tx_out_bare>(miner_tx.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
|
|
@ -1582,7 +1582,7 @@ bool multisig_with_same_id_in_pool::generate(std::vector<test_event_entry>& even
|
|||
se.multisig_id = tx_1_ms_id;
|
||||
se.real_output_in_tx_index = get_tx_out_index_by_amount(tx_1, amount);
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
tx_destination_entry de(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
|
@ -1693,7 +1693,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
se.real_output_in_tx_index = get_tx_out_index_by_amount(tx_1, amount);
|
||||
se.multisig_id = get_multisig_out_id(tx_1, se.real_output_in_tx_index);
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
tx_destination_entry de(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
|
@ -1736,7 +1736,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
se.real_output_in_tx_index = get_tx_out_index_by_amount(tx_3, amount);
|
||||
se.multisig_id = get_multisig_out_id(tx_3, se.real_output_in_tx_index);
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_3);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_3.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_3.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
de = tx_destination_entry(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
|
@ -1767,7 +1767,7 @@ bool multisig_and_checkpoints::generate(std::vector<test_event_entry>& events) c
|
|||
se.real_output_in_tx_index = get_tx_out_index_by_amount(tx_5, amount);
|
||||
se.multisig_id = get_multisig_out_id(tx_5, se.real_output_in_tx_index);
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_5);
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_5.vout[se.real_output_in_tx_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_5.vout[se.real_output_in_tx_index]).target).keys.size();
|
||||
se.ms_sigs_count = 1;
|
||||
|
||||
de = tx_destination_entry(amount - TESTS_DEFAULT_FEE, bob_acc.get_public_address());
|
||||
|
|
@ -1874,7 +1874,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
txb.step1_init();
|
||||
txb.step2_fill_inputs(miner_acc.get_keys(), sources);
|
||||
txb.step3_fill_outputs(destinations, 0, 1);
|
||||
boost::get<txout_multisig>(txb.m_tx.vout[0].target).keys.clear(); // zero keys
|
||||
boost::get<txout_multisig>(txb.boost::get<currency::tx_out_bare>(m_tx.vout[0]).target).keys.clear(); // zero keys
|
||||
txb.step4_calc_hash();
|
||||
txb.step5_sign(sources);
|
||||
transaction tx_4 = txb.m_tx;
|
||||
|
|
@ -1888,8 +1888,8 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
txb.step1_init();
|
||||
txb.step2_fill_inputs(miner_acc.get_keys(), sources);
|
||||
txb.step3_fill_outputs(destinations, 0, 1);
|
||||
crypto::public_key k = boost::get<txout_multisig>(txb.m_tx.vout[0].target).keys[0];
|
||||
boost::get<txout_multisig>(txb.m_tx.vout[0].target).keys.resize(1500, k);
|
||||
crypto::public_key k = boost::get<txout_multisig>(txb.boost::get<currency::tx_out_bare>(m_tx.vout[0]).target).keys[0];
|
||||
boost::get<txout_multisig>(txb.boost::get<currency::tx_out_bare>(m_tx.vout[0]).target).keys.resize(1500, k);
|
||||
txb.step4_calc_hash();
|
||||
txb.step5_sign(sources);
|
||||
txb.m_tx.signatures.clear();
|
||||
|
|
@ -2262,7 +2262,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
size_t ms_out_index = get_multisig_out_index(tx_1.vout);
|
||||
CHECK_AND_ASSERT_MES(ms_out_index != tx_1.vout.size(), false, "Can't find ms out index in tx_1");
|
||||
tx_source_entry se = AUTO_VAL_INIT(se);
|
||||
se.amount = tx_1.vout[ms_out_index].amount;
|
||||
se.amount =boost::get<currency::tx_out_bare>( tx_1.vout[ms_out_index]).amount;
|
||||
se.multisig_id = get_multisig_out_id(tx_1, ms_out_index);
|
||||
se.ms_sigs_count = m_minimum_signs_to_spend;
|
||||
// se.outputs -- not used for ms-outs
|
||||
|
|
@ -2270,7 +2270,7 @@ bool multisig_n_participants_seq_signing::generate(std::vector<test_event_entry>
|
|||
se.real_output_in_tx_index = ms_out_index;
|
||||
se.real_out_tx_key = get_tx_pub_key_from_extra(tx_1);
|
||||
// se.separately_signed_tx_complete -- not a separately-signed tx
|
||||
se.ms_keys_count = boost::get<txout_multisig>(tx_1.vout[ms_out_index].target).keys.size();
|
||||
se.ms_keys_count = boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(tx_1.vout[ms_out_index]).target).keys.size();
|
||||
sources.push_back(se);
|
||||
|
||||
tx_destination_entry de(ms_amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address());
|
||||
|
|
|
|||
|
|
@ -298,11 +298,11 @@ bool mine_next_pos_block_in_playtime_sign_cb(currency::core& c, const currency::
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
|
|||
|
|
@ -71,11 +71,11 @@ bool gen_pos_coinstake_already_spent::generate(std::vector<test_event_entry>& ev
|
|||
uint64_t stake_output_gidx = 0;
|
||||
bool r = find_global_index_for_output(events, prev_id, stake, stake_output_idx, stake_output_gidx);
|
||||
CHECK_AND_ASSERT_MES(r, false, "find_global_index_for_output failed");
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -122,11 +122,11 @@ bool gen_pos_incorrect_timestamp::generate(std::vector<test_event_entry>& events
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -239,11 +239,11 @@ bool gen_pos_extra_nonce::generate(std::vector<test_event_entry>& events) const
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -293,11 +293,11 @@ bool gen_pos_min_allowed_height::generate(std::vector<test_event_entry>& events)
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -345,11 +345,11 @@ bool gen_pos_invalid_coinbase::generate(std::vector<test_event_entry>& events) c
|
|||
crypto::public_key stake_tx_pub_key = get_tx_pub_key_from_extra(stake);
|
||||
size_t stake_output_idx = 0;
|
||||
size_t stake_output_gidx = 0;
|
||||
uint64_t stake_output_amount = stake.vout[stake_output_idx].amount;
|
||||
uint64_t stake_output_amount =boost::get<currency::tx_out_bare>( stake.vout[stake_output_idx]).amount;
|
||||
crypto::key_image stake_output_key_image;
|
||||
keypair kp;
|
||||
generate_key_image_helper(miner_acc.get_keys(), stake_tx_pub_key, stake_output_idx, kp, stake_output_key_image);
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(stake.vout[stake_output_idx].target).key;
|
||||
crypto::public_key stake_output_pubkey = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(stake.vout[stake_output_idx]).target).key;
|
||||
|
||||
pos_block_builder pb;
|
||||
pb.step1_init_header(height, prev_id);
|
||||
|
|
@ -881,7 +881,7 @@ bool pos_altblocks_validation::generate(std::vector<test_event_entry>& events) c
|
|||
// select stake_tx_out_id as an output with the biggest amount
|
||||
for (size_t i = 1; i < stake_tx.vout.size(); ++i)
|
||||
{
|
||||
if (stake_tx.vout[i].amount > stake_tx.vout[stake_tx_out_id].amount)
|
||||
if (boost::get<currency::tx_out_bare>(stake_tx.vout[i]).amount >boost::get<currency::tx_out_bare>( stake_tx.vout[stake_tx_out_id]).amount)
|
||||
stake_tx_out_id = i;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,27 +61,27 @@ bool test_transaction_generation_and_ring_signature()
|
|||
{
|
||||
tx_output_entry oe;
|
||||
oe.first = 0;
|
||||
oe.second = boost::get<txout_to_key>(tx_mine_1.vout[0].target).key;
|
||||
oe.second = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_1.vout[0]).target).key;
|
||||
src.outputs.push_back(oe);
|
||||
|
||||
oe.first = 1;
|
||||
oe.second = boost::get<txout_to_key>(tx_mine_2.vout[0].target).key;
|
||||
oe.second = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_2.vout[0]).target).key;
|
||||
src.outputs.push_back(oe);
|
||||
|
||||
oe.first = 2;
|
||||
oe.second = boost::get<txout_to_key>(tx_mine_3.vout[0].target).key;
|
||||
oe.second = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_3.vout[0]).target).key;
|
||||
src.outputs.push_back(oe);
|
||||
|
||||
oe.first = 3;
|
||||
oe.second = boost::get<txout_to_key>(tx_mine_4.vout[0].target).key;
|
||||
oe.second = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_4.vout[0]).target).key;
|
||||
src.outputs.push_back(oe);
|
||||
|
||||
oe.first = 4;
|
||||
oe.second = boost::get<txout_to_key>(tx_mine_5.vout[0].target).key;
|
||||
oe.second = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_5.vout[0]).target).key;
|
||||
src.outputs.push_back(oe);
|
||||
|
||||
oe.first = 5;
|
||||
oe.second = boost::get<txout_to_key>(tx_mine_6.vout[0].target).key;
|
||||
oe.second = boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_6.vout[0]).target).key;
|
||||
src.outputs.push_back(oe);
|
||||
|
||||
crypto::public_key tx_pub_key = null_pkey;
|
||||
|
|
@ -104,12 +104,12 @@ bool test_transaction_generation_and_ring_signature()
|
|||
|
||||
crypto::hash pref_hash = get_transaction_prefix_hash(tx_rc1);
|
||||
std::vector<const crypto::public_key *> output_keys;
|
||||
output_keys.push_back(&boost::get<txout_to_key>(tx_mine_1.vout[0].target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(tx_mine_2.vout[0].target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(tx_mine_3.vout[0].target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(tx_mine_4.vout[0].target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(tx_mine_5.vout[0].target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(tx_mine_6.vout[0].target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_1.vout[0]).target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_2.vout[0]).target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_3.vout[0]).target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_4.vout[0]).target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_5.vout[0]).target).key);
|
||||
output_keys.push_back(&boost::get<txout_to_key>(boost::get<currency::tx_out_bare>(tx_mine_6.vout[0]).target).key);
|
||||
r = crypto::check_ring_signature(pref_hash, boost::get<txin_to_key>(tx_rc1.vin[0]).k_image, output_keys, &tx_rc1.signatures[0][0]);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to check ring signature");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue