forked from lthn/blockchain
signature refactoring with []
This commit is contained in:
parent
84c0697f1c
commit
4f80c7c334
19 changed files with 130 additions and 151 deletions
|
|
@ -610,17 +610,9 @@ 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;
|
||||
VARIANT_SWITCH_BEGIN(lolcal_chain_entry.tx.signature);
|
||||
VARIANT_CASE_CONST(void_sig, v);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
{
|
||||
signatures_pruned += signatures.s.size();
|
||||
signatures.s.clear();
|
||||
}
|
||||
VARIANT_CASE_CONST(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
signatures_pruned = lolcal_chain_entry.tx.signatures.size();
|
||||
lolcal_chain_entry.tx.signatures.clear();
|
||||
|
||||
attachments_pruned += lolcal_chain_entry.tx.attachment.size();
|
||||
lolcal_chain_entry.tx.attachment.clear();
|
||||
|
||||
|
|
@ -4352,15 +4344,7 @@ bool blockchain_storage::check_tx_inputs(const transaction& tx, const crypto::ha
|
|||
TIME_MEASURE_START_PD(tx_check_inputs_attachment_check);
|
||||
if (!m_is_in_checkpoint_zone)
|
||||
{
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE_CONST(NLSAG_sig, signatures)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(signatures.s.size() == sig_index, false, "tx signatures count differs from inputs");
|
||||
}
|
||||
VARIANT_CASE_CONST(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_CASE_THROW_ON_OTHER();
|
||||
VARIANT_SWITCH_END();
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.s.size() == sig_index, false, "tx signatures count differs from inputs");
|
||||
if (!(get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE))
|
||||
{
|
||||
bool r = validate_attachment_info(tx.extra, tx.attachment, false);
|
||||
|
|
@ -4509,15 +4493,19 @@ bool blockchain_storage::check_input_signature(const transaction& tx,
|
|||
if(m_is_in_checkpoint_zone)
|
||||
return true;
|
||||
|
||||
CHECK_AND_ASSERT_MES(tx.signature.type() == typeid(NLSAG_sig), false, "Unexpected type of sig in check_input_signature: " << tx.signature.type().name());
|
||||
auto s = boost::get<NLSAG_sig>(tx.signature).s;
|
||||
uint64_t actual_sig_index = in_index;
|
||||
if (is_pos_coinbase(tx))
|
||||
{
|
||||
actual_sig_index = 0;
|
||||
}
|
||||
CHECK_AND_ASSERT_MES(s.size() > actual_sig_index, false, "Failed to check s.size(){" << s.size() << "} > actual_sig_index {" << actual_sig_index << "}" );
|
||||
const std::vector<crypto::signature>& sig = s[actual_sig_index];
|
||||
|
||||
|
||||
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.size() > actual_sig_index, false, "Failed to check s.size(){" << tx.signatures.size() << "} > actual_sig_index {" << actual_sig_index << "}" );
|
||||
|
||||
CHECK_AND_ASSERT_MES(tx.signatures[actual_sig_index].type() == typeid(NLSAG_sig), false, "Unexpected type of sig in check_input_signature: " << tx.signatures[actual_sig_index].type().name());
|
||||
const std::vector<crypto::signature>& sig = boost::get<NLSAG_sig>(tx.signatures[actual_sig_index]).s;
|
||||
|
||||
if (get_tx_flags(tx) & TX_FLAG_SIGNATURE_MODE_SEPARATE)
|
||||
{
|
||||
// check attachments, mentioned directly in this input
|
||||
|
|
@ -4605,12 +4593,15 @@ 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);
|
||||
}
|
||||
bool need_to_check_extra_sign = false;
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
|
||||
LOC_CHK(tx.signatures.size() > in_index, "ms input index is out of signatures container bounds, signatures.size() = " << tx.signatures.size());
|
||||
|
||||
//@#@
|
||||
VARIANT_SWITCH_BEGIN(tx.signatures[in_index]);
|
||||
VARIANT_CASE_CONST(void_sig, v);
|
||||
VARIANT_CASE_CONST(NLSAG_sig, signatures)
|
||||
{
|
||||
LOC_CHK(signatures.s.size() > in_index, "ms input index is out of signatures container bounds, signatures.size() = " << signatures.s.size());
|
||||
const std::vector<crypto::signature>& input_signatures = signatures.s[in_index];
|
||||
VARIANT_CASE_CONST(NLSAG_sig, sig)
|
||||
{
|
||||
const std::vector<crypto::signature>& input_signatures = sig.s;
|
||||
|
||||
size_t expected_signatures_count = txin.sigs_count;
|
||||
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
|
||||
|
|
@ -4644,24 +4635,19 @@ bool blockchain_storage::check_ms_input(const transaction& tx, size_t in_index,
|
|||
out_key_index++;
|
||||
}
|
||||
}
|
||||
|
||||
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), input_signatures.back());
|
||||
LOC_CHK(r, "failed to check extra signature for last out with TX_FLAG_SIGNATURE_MODE_SEPARATE");
|
||||
}
|
||||
}
|
||||
VARIANT_CASE_CONST(zarcanum_sig, s);
|
||||
//@#@
|
||||
//TODO: don't forget about need_to_check_extra_sign
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
if (need_to_check_extra_sign)
|
||||
{
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE_CONST(void_sig, v);
|
||||
VARIANT_CASE_CONST(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_CONST(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -4738,7 +4724,6 @@ bool blockchain_storage::check_tx_input(const transaction& tx, size_t in_index,
|
|||
|
||||
//TIME_MEASURE_FINISH_PD(tx_check_inputs_loop_ch_in_get_keys_loop);
|
||||
|
||||
|
||||
|
||||
std::vector<const crypto::public_key *> output_keys_ptrs;
|
||||
output_keys_ptrs.reserve(output_keys.size());
|
||||
|
|
@ -4746,19 +4731,9 @@ bool blockchain_storage::check_tx_input(const transaction& tx, size_t in_index,
|
|||
output_keys_ptrs.push_back(&ptr);
|
||||
|
||||
CHECK_AND_ASSERT_THROW_MES(output_keys_ptrs.size() == 1, "Internal error: output_keys_ptrs.size() is not equal 1 for HTLC");
|
||||
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE_CONST(NLSAG_sig, signatures);
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(signatures.s.size() > in_index, false, "Unexpeted number of singatures in NLSAG_sig: " << signatures.s.size() << ", expected at least: " << in_index);
|
||||
return check_input_signature(tx, in_index, txin.amount, txin.k_image, txin.etc_details, tx_prefix_hash, output_keys_ptrs);
|
||||
}
|
||||
VARIANT_CASE_CONST(zarcanum_sig, s);
|
||||
//@#@ TODO
|
||||
return false;
|
||||
VARIANT_CASE_THROW_ON_OTHER();
|
||||
VARIANT_SWITCH_END();
|
||||
return false;
|
||||
|
||||
|
||||
return check_input_signature(tx, in_index, txin.amount, txin.k_image, txin.etc_details, tx_prefix_hash, output_keys_ptrs);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
uint64_t blockchain_storage::get_adjusted_time() const
|
||||
|
|
@ -5536,13 +5511,7 @@ 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)
|
||||
{
|
||||
VARIANT_SWITCH_BEGIN(tx.signature);
|
||||
VARIANT_CASE(NLSAG_sig, signatures)
|
||||
signatures.s.clear();
|
||||
VARIANT_CASE_CONST(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
|
||||
tx.signatures.clear();
|
||||
tx.attachment.clear();
|
||||
}
|
||||
TIME_MEASURE_START_PD(tx_add_one_tx_time);
|
||||
|
|
@ -6734,11 +6703,9 @@ 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)
|
||||
&& input_tx.signature.type() == typeid(NLSAG_sig), false, "invalid ms input index: " << input_index << " or type");
|
||||
&& input_tx.vin[input_index].type() == typeid(txin_multisig), 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)
|
||||
|
|
@ -6930,17 +6897,10 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
|
|||
uint64_t ki_lookup = 0;
|
||||
|
||||
// check PoS block miner tx in a special way
|
||||
VARIANT_SWITCH_BEGIN(b.miner_tx.signature);
|
||||
VARIANT_CASE_CONST(void_sig, v);
|
||||
VARIANT_CASE_CONST(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, 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_CONST(zarcanum_sig, s);
|
||||
//@#@
|
||||
VARIANT_SWITCH_END();
|
||||
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());
|
||||
|
||||
r = validate_alt_block_input(b.miner_tx, collected_keyimages, alt_chain_tx_ids, id, get_block_hash(b), 1, 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");
|
||||
|
||||
ki_lookup_time_total += ki_lookup;
|
||||
// check stake age
|
||||
|
|
@ -6961,10 +6921,8 @@ 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;
|
||||
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: signatures.size() == " << boost::get<NLSAG_sig>(tx.signature).s.size() << ", tx.vin.size() == " << tx.vin.size());
|
||||
}
|
||||
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.size() == tx.vin.size(), false, "invalid tx: signatures.size() == " << tx.signatures.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))
|
||||
|
|
@ -6976,7 +6934,7 @@ bool blockchain_storage::validate_alt_block_txs(const block& b, const crypto::ha
|
|||
}
|
||||
else if (tx.vin[n].type() == typeid(txin_multisig))
|
||||
{
|
||||
r = validate_alt_block_ms_input(tx, tx_id, n, tx.signature, split_height, alt_chain);
|
||||
r = validate_alt_block_ms_input(tx, tx_id, n, 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))
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ namespace currency
|
|||
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,
|
||||
//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;
|
||||
|
|
|
|||
|
|
@ -658,7 +658,7 @@ namespace currency
|
|||
//classic CryptoNote signature by Nicolas Van Saberhagen
|
||||
struct NLSAG_sig
|
||||
{
|
||||
std::vector<std::vector<crypto::signature> > s;
|
||||
std::vector<crypto::signature> s;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(s)
|
||||
|
|
@ -679,6 +679,21 @@ namespace currency
|
|||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
//TODO: @val, should we call it something like schnorr_sig ?
|
||||
struct simple_sig
|
||||
{
|
||||
crypto::signature s;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(s)
|
||||
END_SERIALIZE()
|
||||
|
||||
BEGIN_BOOST_SERIALIZATION()
|
||||
BOOST_SERIALIZE(s)
|
||||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
|
||||
struct void_sig
|
||||
{
|
||||
//TODO:
|
||||
|
|
@ -689,6 +704,7 @@ namespace currency
|
|||
END_BOOST_SERIALIZATION()
|
||||
};
|
||||
|
||||
|
||||
typedef boost::variant<NLSAG_sig, void_sig, zarcanum_sig> signature_v;
|
||||
|
||||
|
||||
|
|
@ -734,7 +750,7 @@ namespace currency
|
|||
class transaction: public transaction_prefix
|
||||
{
|
||||
public:
|
||||
signature_v signature;
|
||||
std::vector<signature_v> signatures;
|
||||
std::vector<attachment_v> attachment;
|
||||
|
||||
transaction();
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ namespace boost
|
|||
a & x.vin;
|
||||
a & x.vout;
|
||||
a & x.extra;
|
||||
a & x.signature;
|
||||
a & x.signatures;
|
||||
a & x.attachment;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,9 +196,10 @@ namespace currency
|
|||
posin.k_image = pe.keyimage;
|
||||
tx.vin.push_back(posin);
|
||||
//reserve place for ring signature
|
||||
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());
|
||||
//tx.signature = NLSAG_sig();
|
||||
tx.signatures.resize(1);
|
||||
tx.signatures[0] = NLSAG_sig();
|
||||
boost::get<NLSAG_sig>(tx.signatures[0]).s.resize(posin.key_offsets.size());
|
||||
}
|
||||
|
||||
uint64_t no = 0;
|
||||
|
|
@ -1283,7 +1284,6 @@ namespace currency
|
|||
{
|
||||
tx.vin.clear();
|
||||
tx.vout.clear();
|
||||
tx.signature = NLSAG_sig();
|
||||
tx.extra = extra;
|
||||
|
||||
tx.version = ftp.tx_version;
|
||||
|
|
@ -1536,8 +1536,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");
|
||||
|
||||
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();
|
||||
tx.signatures.push_back(NLSAG_sig());
|
||||
std::vector<crypto::signature>& sigs = boost::get<NLSAG_sig>(tx.signatures.back()).s;
|
||||
|
||||
if(src_entr.is_multisig())
|
||||
{
|
||||
|
|
@ -1688,12 +1688,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(tx.signature.type() == typeid(NLSAG_sig), "Wrong type of signature");
|
||||
|
||||
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(ms_input_index < tx.signatures.size(), "transaction does not have signatures vector entry for ms input #" << ms_input_index);
|
||||
|
||||
LOC_CHK(tx.signatures[ms_input_index].type() == typeid(NLSAG_sig), "Wrong type of signature");
|
||||
auto& sigs = boost::get<NLSAG_sig>(tx.signatures[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;
|
||||
|
|
@ -2866,8 +2867,12 @@ 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.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();
|
||||
if (tx.signatures.size() >= tei.ins.size() &&
|
||||
tx.signatures[tei.ins.size() - 1].type() == typeid(NLSAG_sig))
|
||||
{
|
||||
tei.ins.back().multisig_count = boost::get<NLSAG_sig>(tx.signatures[tei.ins.size() - 1]).s.size();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1835,9 +1835,9 @@ bool sign_multisig_input_in_tx_custom(currency::transaction& tx, size_t ms_input
|
|||
bool r = currency::derive_ephemeral_key_helper(keys, source_tx_pub_key, ms_out_index, ms_in_ephemeral_key);
|
||||
LOC_CHK(r, "derive_ephemeral_key_helper failed");
|
||||
|
||||
LOC_CHK(ms_input_index < boost::get<currency::NLSAG_sig>(tx.signature).s.size(), "transaction does not have signatures vectory entry for ms input #" << ms_input_index);
|
||||
LOC_CHK(ms_input_index < tx.signatures.size(), "transaction does not have signatures vectory entry for ms input #" << ms_input_index);
|
||||
|
||||
auto& sigs = boost::get<currency::NLSAG_sig>(tx.signature).s[ms_input_index];
|
||||
auto& sigs = boost::get<currency::NLSAG_sig>(tx.signatures[ms_input_index]).s;
|
||||
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;
|
||||
size_t allocated_sigs_for_participants = extra_signature_expected ? sigs.size() - 1 : sigs.size();
|
||||
|
|
|
|||
|
|
@ -744,7 +744,7 @@ bool construct_broken_tx(const currency::account_keys& sender_account_keys, cons
|
|||
{
|
||||
tx.vin.clear();
|
||||
tx.vout.clear();
|
||||
boost::get<currency::NLSAG_sig>(tx.signature).s.clear();
|
||||
tx.signatures.clear();
|
||||
tx.extra = extra;
|
||||
|
||||
tx.version = TRANSACTION_VERSION_PRE_HF4;
|
||||
|
|
@ -846,8 +846,8 @@ bool construct_broken_tx(const currency::account_keys& sender_account_keys, cons
|
|||
ss_ring_s << o.second << ENDL;
|
||||
}
|
||||
|
||||
boost::get<currency::NLSAG_sig>(tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
std::vector<crypto::signature>& sigs = boost::get<currency::NLSAG_sig>(tx.signature).s.back();
|
||||
tx.signatures.push_back(currency::NLSAG_sig(std::vector<crypto::signature>()));
|
||||
std::vector<crypto::signature>& sigs = boost::get<currency::NLSAG_sig>(tx.signatures.back()).s;
|
||||
sigs.resize(src_entr.outputs.size());
|
||||
crypto::generate_ring_signature(tx_prefix_hash, boost::get<currency::txin_to_key>(tx.vin[i]).k_image, keys_ptrs, in_contexts[i].in_ephemeral.sec, src_entr.real_output, sigs.data());
|
||||
ss_ring_s << "signatures:" << ENDL;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ inline bool resign_tx(const currency::account_keys& sender_keys, const std::vect
|
|||
if (sources.size() != tx.vin.size())
|
||||
return false;
|
||||
|
||||
boost::get<currency::NLSAG_sig>(tx.signature).s.clear();
|
||||
tx.signatures.clear();
|
||||
crypto::hash tx_prefix_hash = get_transaction_hash(tx);
|
||||
|
||||
size_t i = 0;
|
||||
|
|
@ -234,8 +234,8 @@ inline bool resign_tx(const currency::account_keys& sender_keys, const std::vect
|
|||
return false;
|
||||
crypto::derive_secret_key(recv_derivation, se.real_output_in_tx_index, sender_keys.spend_secret_key, in_ephemeral_sec);
|
||||
|
||||
boost::get<currency::NLSAG_sig>(tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
std::vector<crypto::signature>& sigs = boost::get<currency::NLSAG_sig>(tx.signature).s.back();
|
||||
tx.signatures.push_back(currency::NLSAG_sig(std::vector<crypto::signature>()));
|
||||
std::vector<crypto::signature>& sigs = boost::get<currency::NLSAG_sig>(tx.signatures.back()).s;
|
||||
|
||||
if (se.is_multisig())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ public:
|
|||
return; // skip certainly invalid txs
|
||||
|
||||
bool b_cp = c.get_blockchain_storage().is_in_checkpoint_zone();
|
||||
if (b_cp && boost::get<currency::NLSAG_sig>(tx.signature).s.empty() && tx.attachment.empty())
|
||||
if (b_cp && tx.signatures.empty() && tx.attachment.empty())
|
||||
return; // skip pruned txs in CP zone
|
||||
|
||||
size_t tx_expected_blob_size = get_object_blobsize(tx);
|
||||
|
|
@ -328,7 +328,7 @@ public:
|
|||
{
|
||||
// tx seems to be correct ( tx_expected_blob_size == blob.size() ) or BCS is in CP zone, prune sigs and attachments and check again
|
||||
currency::transaction pruned_tx = tx;
|
||||
boost::get<currency::NLSAG_sig>(pruned_tx.signature).s.clear();
|
||||
pruned_tx.signatures.clear();
|
||||
pruned_tx.attachment.clear();
|
||||
size_t pruned_tx_expected_blob_size = get_object_blobsize(pruned_tx);
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ bool gen_checkpoints_attachments_basic::check_tx(currency::core& c, size_t ev_in
|
|||
bool r = c.get_transaction(m_tx_hash, tx);
|
||||
CHECK_AND_ASSERT_MES(r, false, "can't get transaction");
|
||||
|
||||
CHECK_AND_ASSERT_MES(boost::get<currency::NLSAG_sig>(tx.signature).s.empty(), false, "tx has non-empty sig");
|
||||
CHECK_AND_ASSERT_MES(tx.signatures.empty(), false, "tx has non-empty sig");
|
||||
CHECK_AND_ASSERT_MES(tx.attachment.empty(), false, "tx has non-empty attachments");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -443,12 +443,12 @@ bool gen_checkpoints_prun_txs_after_blockchain_load::check_txs(currency::core& c
|
|||
transaction tx_0, tx_1;
|
||||
bool r = c.get_transaction(m_tx0_id, tx_0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "can't get transaction tx_0");
|
||||
CHECK_AND_ASSERT_MES(boost::get<currency::NLSAG_sig>(tx_0.signature).s.empty(), false, "tx_0 has non-empty sig");
|
||||
CHECK_AND_ASSERT_MES(tx_0.signatures.empty(), false, "tx_0 has non-empty sig");
|
||||
CHECK_AND_ASSERT_MES(tx_0.attachment.empty(), false, "tx_0 has non-empty attachments");
|
||||
|
||||
r = c.get_transaction(m_tx1_id, tx_1);
|
||||
CHECK_AND_ASSERT_MES(r, false, "can't get transaction tx_1");
|
||||
CHECK_AND_ASSERT_MES(!boost::get<currency::NLSAG_sig>(tx_1.signature).s.empty(), false, "tx_1 has empty sig");
|
||||
CHECK_AND_ASSERT_MES(!tx_1.signatures.empty(), false, "tx_1 has empty sig");
|
||||
CHECK_AND_ASSERT_MES(!tx_1.attachment.empty(), false, "tx_1 has empty attachments");
|
||||
|
||||
return true;
|
||||
|
|
@ -595,7 +595,7 @@ bool gen_checkpoints_pos_validation_on_altchain::generate(std::vector<test_event
|
|||
|
||||
// don't sign at all
|
||||
//pb.step5_sign(stake_tx_pub_key, stake_output_idx, stake_output_pubkey, miner_acc);
|
||||
boost::get<currency::NLSAG_sig>(pb.m_block.miner_tx.signature).s[0].clear(); // just to make sure
|
||||
boost::get<currency::NLSAG_sig>(pb.m_block.miner_tx.signatures[0]).s.clear(); // just to make sure
|
||||
|
||||
blk_2 = pb.m_block;
|
||||
}
|
||||
|
|
@ -875,7 +875,7 @@ bool gen_checkpoints_and_invalid_tx_to_pool::generate(std::vector<test_event_ent
|
|||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
// invalidate tx_0 signature
|
||||
boost::get<currency::NLSAG_sig>(tx_0.signature).s.clear();
|
||||
tx_0.signatures.clear();
|
||||
|
||||
DO_CALLBACK(events, "mark_unverifiable_tx");
|
||||
events.push_back(tx_0);
|
||||
|
|
|
|||
|
|
@ -253,8 +253,8 @@ inline bool build_custom_escrow_template(const std::vector<test_event_entry>& ev
|
|||
|
||||
if (custom_config_mask & eccf_template_no_a_sigs)
|
||||
{
|
||||
boost::get<currency::NLSAG_sig>(escrow_template_tx.signature).s.clear();
|
||||
boost::get<currency::NLSAG_sig>(escrow_template_tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
escrow_template_tx.signatures.clear();
|
||||
escrow_template_tx.signatures.push_back(currency::NLSAG_sig(std::vector<crypto::signature>()));
|
||||
}
|
||||
|
||||
append_vector_by_another_vector(used_sources, sources);
|
||||
|
|
|
|||
|
|
@ -1037,7 +1037,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
CHECK_AND_ASSERT_MES(r && !tx_fully_signed, false, "sign_multisig_input_in_tx failed, tx_fully_signed : " << tx_fully_signed);
|
||||
r = sign_multisig_input_in_tx_custom(tx_7, ms_6_out_idx, miner_acc.get_keys(), tx_6, &tx_fully_signed, false);
|
||||
CHECK_AND_ASSERT_MES(r && !tx_fully_signed, false, "sign_multisig_input_in_tx failed, tx_fully_signed : " << tx_fully_signed);
|
||||
boost::get<currency::NLSAG_sig>(tx_7.signature).s[0].push_back(invalid_signature); // instead of 4th sig just add invalid sig
|
||||
boost::get<currency::NLSAG_sig>(tx_7.signatures[0]).s.push_back(invalid_signature); // instead of 4th sig just add invalid sig
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(tx_7);
|
||||
|
|
@ -1073,7 +1073,7 @@ bool multisig_minimum_sigs::generate(std::vector<test_event_entry>& events) cons
|
|||
r = construct_tx(miner_acc.get_keys(), std::vector<tx_source_entry>({ se }), std::vector<tx_destination_entry>({ tx_destination_entry(se.amount - TESTS_DEFAULT_FEE, alice_acc.get_public_address()) }), empty_attachment, tx_9, get_tx_version_from_events(events), 0);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx failed");
|
||||
|
||||
boost::get<currency::NLSAG_sig>(tx_9.signature).s[0].resize(redundant_keys_count, invalid_signature);
|
||||
boost::get<currency::NLSAG_sig>(tx_9.signatures[0]).s.resize(redundant_keys_count, invalid_signature);
|
||||
|
||||
r = sign_multisig_input_in_tx_custom(tx_9, ms_8_out_idx, bob_acc.get_keys(), tx_8, &tx_fully_signed, false);
|
||||
CHECK_AND_ASSERT_MES(r && !tx_fully_signed, false, "sign_multisig_input_in_tx failed, tx_fully_signed : " << tx_fully_signed);
|
||||
|
|
@ -1847,7 +1847,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
transaction tx_2 = AUTO_VAL_INIT(tx_2);
|
||||
r = make_tx_multisig_to_key(tx_1, get_tx_out_index_by_amount(tx_1, amount), std::list<account_keys>({ alice_acc.get_keys() }), bob_acc.get_public_address(), tx_2);
|
||||
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
|
||||
boost::get<currency::NLSAG_sig>(tx_2.signature).s.resize(10);
|
||||
tx_2.signatures.resize(10);
|
||||
boost::get<txin_multisig>(tx_2.vin[0]).sigs_count = 10;
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
|
|
@ -1863,7 +1863,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
transaction tx_3 = AUTO_VAL_INIT(tx_3);
|
||||
r = make_tx_multisig_to_key(tx_1, get_tx_out_index_by_amount(tx_1, amount), std::list<account_keys>({ alice_acc.get_keys() }), bob_acc.get_public_address(), tx_3);
|
||||
CHECK_AND_ASSERT_MES(r, false, "make_tx_multisig_to_key failed");
|
||||
boost::get<currency::NLSAG_sig>(tx_3.signature).s.clear();
|
||||
tx_3.signatures.clear();
|
||||
boost::get<txin_multisig>(tx_3.vin[0]).sigs_count = 0;
|
||||
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true));
|
||||
|
|
@ -1895,7 +1895,7 @@ bool multisig_and_checkpoints_bad_txs::generate(std::vector<test_event_entry>& e
|
|||
boost::get<txout_multisig>(boost::get<currency::tx_out_bare>(txb.m_tx.vout[0]).target).keys.resize(1500, k);
|
||||
txb.step4_calc_hash();
|
||||
txb.step5_sign(sources);
|
||||
boost::get<currency::NLSAG_sig>(txb.m_tx.signature).s.clear();
|
||||
txb.m_tx.signatures.clear();
|
||||
transaction tx_6 = txb.m_tx;
|
||||
events.push_back(event_visitor_settings(event_visitor_settings::set_txs_kept_by_block, true));
|
||||
events.push_back(tx_6);
|
||||
|
|
@ -2116,7 +2116,7 @@ bool ref_by_id_basics::generate(std::vector<test_event_entry>& events) const
|
|||
r = construct_tx(miner_acc.get_keys(), sources, destinations, empty_attachment, tx_1, 0, CURRENCY_TO_KEY_OUT_RELAXED, true);
|
||||
CHECK_AND_ASSERT_MES(r, false, "construct_tx");
|
||||
|
||||
r = check_ring_signature_at_gen_time(events, get_block_hash(blk_0r), boost::get<txin_to_key>(tx_1.vin[0]), get_transaction_hash(tx_1), boost::get<currency::NLSAG_sig>(tx_1.signature).s[0]);
|
||||
r = check_ring_signature_at_gen_time(events, get_block_hash(blk_0r), boost::get<txin_to_key>(tx_1.vin[0]), get_transaction_hash(tx_1), boost::get<currency::NLSAG_sig>(tx_1.signatures[0]).s);
|
||||
CHECK_AND_ASSERT_MES(r, false, "check_ring_signature_at_gen_time failed");
|
||||
|
||||
events.push_back(tx_1);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void pos_block_builder::step5_sign(const crypto::public_key& stake_tx_pub_key, s
|
|||
// sign block actually in coinbase transaction
|
||||
crypto::hash block_hash = currency::get_block_hash(m_block);
|
||||
std::vector<const crypto::public_key*> keys_ptrs(1, &stake_tx_out_pub_key);
|
||||
crypto::generate_ring_signature(block_hash, m_stake_kernel.kimage, keys_ptrs, derived_secret_ephemeral_key, 0, &boost::get<currency::NLSAG_sig>(m_block.miner_tx.signature).s[0][0]);
|
||||
crypto::generate_ring_signature(block_hash, m_stake_kernel.kimage, keys_ptrs, derived_secret_ephemeral_key, 0, &boost::get<currency::NLSAG_sig>(m_block.miner_tx.signatures[0]).s[0]);
|
||||
|
||||
m_step = 5;
|
||||
}
|
||||
|
|
@ -272,8 +272,8 @@ bool construct_homemade_pos_miner_tx(size_t height, size_t median_size, const bo
|
|||
posin.k_image = pos_stake_keyimage;
|
||||
tx.vin.push_back(posin);
|
||||
//reserve place for ring signature
|
||||
boost::get<currency::NLSAG_sig>(tx.signature).s.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(tx.signature).s[0].resize(posin.key_offsets.size());
|
||||
tx.signatures.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(tx.signatures[0]).s.resize(posin.key_offsets.size());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ bool gen_pos_invalid_coinbase::generate(std::vector<test_event_entry>& events) c
|
|||
pb.step4_generate_coinbase_tx(generator.get_timestamps_median(prev_id), generator.get_already_generated_coins(prev_block), alice_acc.get_public_address());
|
||||
pb.step5_sign(stake_tx_pub_key, stake_output_idx, stake_output_pubkey, miner_acc);
|
||||
|
||||
boost::get<currency::NLSAG_sig>(pb.m_block.miner_tx.signature).s.clear(); // remove signatures
|
||||
pb.m_block.miner_tx.signatures.clear(); // remove signatures
|
||||
|
||||
block blk_1 = pb.m_block;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ struct ev_visitor : public boost::static_visitor<bool>
|
|||
{
|
||||
size_t real_bloc_size = t_serializable_object_to_blob(t).size();
|
||||
|
||||
std::cout << "prunging sigs: " << boost::get<currency::NLSAG_sig>(t.signature).s.size() << ENDL;
|
||||
boost::get<currency::NLSAG_sig>(t.signature).s.clear();
|
||||
std::cout << "prunging sigs: " << t.signatures.size() << ENDL;
|
||||
t.signatures.clear();
|
||||
|
||||
//check tx pruning correctnes
|
||||
if (real_bloc_size != get_object_blobsize(t))
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ bool test_transaction_generation_and_ring_signature()
|
|||
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, &boost::get<currency::NLSAG_sig>(tx_rc1.signature).s[0][0]);
|
||||
r = crypto::check_ring_signature(pref_hash, boost::get<txin_to_key>(tx_rc1.vin[0]).k_image, output_keys, &boost::get<currency::NLSAG_sig>(tx_rc1.signatures[0]).s[0]);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to check ring signature");
|
||||
|
||||
std::vector<size_t> outs;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ struct tx_builder
|
|||
|
||||
void step5_sign(const std::vector<currency::tx_source_entry>& sources)
|
||||
{
|
||||
boost::get<currency::NLSAG_sig>(m_tx.signature).s.clear();
|
||||
m_tx.signatures.clear();
|
||||
|
||||
size_t i = 0;
|
||||
for(const currency::tx_source_entry& src_entr : sources)
|
||||
|
|
@ -109,8 +109,8 @@ struct tx_builder
|
|||
keys_ptrs.push_back(&o.second);
|
||||
}
|
||||
|
||||
boost::get<currency::NLSAG_sig>(m_tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
std::vector<crypto::signature>& sigs = boost::get<currency::NLSAG_sig>(m_tx.signature).s.back();
|
||||
m_tx.signatures.push_back(currency::NLSAG_sig(std::vector<crypto::signature>()));
|
||||
std::vector<crypto::signature>& sigs = boost::get<currency::NLSAG_sig>(m_tx.signatures.back()).s;
|
||||
sigs.resize(src_entr.outputs.size());
|
||||
generate_ring_signature(m_tx_prefix_hash, boost::get<currency::txin_to_key>(m_tx.vin[i]).k_image, keys_ptrs, m_in_contexts[i].sec, src_entr.real_output, sigs.data());
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -370,9 +370,9 @@ bool gen_tx_key_image_not_derive_from_tx_key::generate(std::vector<test_event_en
|
|||
builder.step4_calc_hash();
|
||||
|
||||
// Tx with invalid key image can't be subscribed, so create empty signature
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signature).s.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signature).s[0].resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signature).s[0][0] = boost::value_initialized<crypto::signature>();
|
||||
builder.m_tx.signatures.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signatures[0]).s.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signatures[0]).s[0] = boost::value_initialized<crypto::signature>();
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(builder.m_tx);
|
||||
|
|
@ -404,9 +404,9 @@ bool gen_tx_key_image_is_invalid::generate(std::vector<test_event_entry>& events
|
|||
builder.step4_calc_hash();
|
||||
|
||||
// Tx with invalid key image can't be subscribed, so create empty signature
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signature).s.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signature).s[0].resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signature).s[0][0] = boost::value_initialized<crypto::signature>();
|
||||
builder.m_tx.signatures.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signatures[0]).s.resize(1);
|
||||
boost::get<currency::NLSAG_sig>(builder.m_tx.signatures[0]).s[0] = boost::value_initialized<crypto::signature>();
|
||||
|
||||
DO_CALLBACK(events, "mark_invalid_tx");
|
||||
events.push_back(builder.m_tx);
|
||||
|
|
@ -633,62 +633,62 @@ bool gen_tx_signatures_are_invalid::generate(std::vector<test_event_entry>& even
|
|||
// create reference transaction tx_0, Carol->Alice, nmix=0
|
||||
MAKE_TX(events, tx_0, carol_account, alice_account, amount, blk_1r_f);
|
||||
events.pop_back();
|
||||
CHECK_AND_ASSERT_MES(tx_0.vin.size() > 1 && tx_0.vout.size() > 1 && boost::get<currency::NLSAG_sig>(tx_0.signature).s.size() > 1, false, "tx_0 is incorrect"); // need > 1 for this test
|
||||
CHECK_AND_ASSERT_MES(tx_0.vin.size() > 1 && tx_0.vout.size() > 1 && tx_0.signatures.size() > 1, false, "tx_0 is incorrect"); // need > 1 for this test
|
||||
|
||||
// create reference transaction tx_1, Dan->Alice, nmix=1
|
||||
MAKE_TX_MIX(events, tx_1, dan_account, alice_account, amount, 1, blk_1r_f);
|
||||
events.pop_back();
|
||||
CHECK_AND_ASSERT_MES(tx_1.vin.size() > 1 && tx_1.vout.size() > 1 && boost::get<currency::NLSAG_sig>(tx_1.signature).s.size() > 1, false, "tx_1 is incorrect"); // need > 1 for this test
|
||||
CHECK_AND_ASSERT_MES(tx_1.vin.size() > 1 && tx_1.vout.size() > 1 && tx_1.signatures.size() > 1, false, "tx_1 is incorrect"); // need > 1 for this test
|
||||
|
||||
const block& prev_block = blk_1r_f;
|
||||
transaction broken_tx;
|
||||
|
||||
// Tx with nmix = 0 without signatures
|
||||
broken_tx = tx_0;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.clear();
|
||||
broken_tx.signatures.clear();
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 0 have a few inputs, and not enough signatures
|
||||
broken_tx = tx_0;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.resize(boost::get<currency::NLSAG_sig>(broken_tx.signature).s.size() - 1);
|
||||
broken_tx.signatures.resize(broken_tx.signatures.size() - 1);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 0 have a few inputs, and too many signatures (1/2)
|
||||
broken_tx = tx_0;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.back().push_back(invalid_signature);
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signatures.back()).s.push_back(invalid_signature);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 0 have a few inputs, and too many signatures (2/2)
|
||||
broken_tx = tx_0;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.back().push_back(invalid_signature);
|
||||
broken_tx.signatures.push_back(currency::NLSAG_sig(std::vector<crypto::signature>()));
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signatures.back()).s.push_back(invalid_signature);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
|
||||
// Tx with nmix = 1 without signatures
|
||||
broken_tx = tx_1;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.clear();
|
||||
broken_tx.signatures.clear();
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 1 have not enough signatures (1/2)
|
||||
broken_tx = tx_1;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.resize(boost::get<currency::NLSAG_sig>(broken_tx.signature).s.size() - 1);
|
||||
broken_tx.signatures.resize(broken_tx.signatures.size() - 1);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 1 have not enough signatures (2/2)
|
||||
broken_tx = tx_1;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.back().resize(boost::get<currency::NLSAG_sig>(broken_tx.signature).s.back().size() - 1);
|
||||
broken_tx.signatures.back().resize(boost::get<currency::NLSAG_sig>(broken_tx.signatures.back()).s.size() - 1);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 1 have too many signatures (1/2)
|
||||
broken_tx = tx_1;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.back().push_back(invalid_signature);
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signatures.back()).s.push_back(invalid_signature);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
// Tx with nmix = 1 have too many signatures (2/2)
|
||||
broken_tx = tx_1;
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.push_back(std::vector<crypto::signature>());
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signature).s.back().push_back(invalid_signature);
|
||||
broken_tx.signatures.push_back(currency::NLSAG_sig(std::vector<crypto::signature>()));
|
||||
boost::get<currency::NLSAG_sig>(broken_tx.signatures.back()).s.push_back(invalid_signature);
|
||||
check_broken_tx(events, broken_tx, prev_block, miner_account, generator);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public:
|
|||
bool test()
|
||||
{
|
||||
const currency::txin_to_key& txin = boost::get<currency::txin_to_key>(m_tx.vin[0]);
|
||||
return crypto::check_ring_signature(m_tx_prefix_hash, txin.k_image, this->m_public_key_ptrs, ring_size, boost::get<NLSAG_sig>(m_tx.signature)[0].data());
|
||||
return crypto::check_ring_signature(m_tx_prefix_hash, txin.k_image, this->m_public_key_ptrs, ring_size, boost::get<NLSAG_sig>(m_tx.signatures[0]).s.data());
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue