blockchain: reinstate double spending checks in check_tx_inputs

This fixes some double spending tests.
This may or may not be unneeded in normal (non test) circumstances,
to be determined later. Keeping these for now may be slower, but safer.
This commit is contained in:
moneromooo-monero 2015-12-25 22:11:21 +00:00
parent 737b6d6cf5
commit f294be35bc
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 7 additions and 3 deletions

View File

@ -2008,9 +2008,7 @@ bool Blockchain::have_tx_keyimges_as_spent(const transaction &tx) const
return false;
}
//------------------------------------------------------------------
// This function validates transaction inputs and their keys. Previously
// it also performed double spend checking, but that has been moved to its
// own function.
// This function validates transaction inputs and their keys.
bool Blockchain::check_tx_inputs(const transaction& tx, uint64_t* pmax_used_block_height)
{
LOG_PRINT_L3("Blockchain::" << __func__);
@ -2112,6 +2110,12 @@ bool Blockchain::check_tx_inputs(const transaction& tx, uint64_t* pmax_used_bloc
// make sure tx output has key offset(s) (is signed to be used)
CHECK_AND_ASSERT_MES(in_to_key.key_offsets.size(), false, "empty in_to_key.key_offsets in transaction with id " << get_transaction_hash(tx));
if(have_tx_keyimg_as_spent(in_to_key.k_image))
{
LOG_PRINT_L1("Key image already spent in blockchain: " << epee::string_tools::pod_to_hex(in_to_key.k_image));
return false;
}
// basically, make sure number of inputs == number of signatures
CHECK_AND_ASSERT_MES(sig_index < tx.signatures.size(), false, "wrong transaction: not signature entry for input with index= " << sig_index);