forked from lthn/blockchain
tx pool: added ability to disable tx validation for tests
This commit is contained in:
parent
b72a0593c6
commit
df7b6a3674
2 changed files with 19 additions and 0 deletions
|
|
@ -104,6 +104,20 @@ namespace currency
|
|||
//---------------------------------------------------------------------------------
|
||||
bool tx_memory_pool::add_tx(const transaction &tx, const crypto::hash &id, uint64_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool from_core)
|
||||
{
|
||||
// ------------------ UNSECURE CODE FOR TESTS ---------------------
|
||||
if (m_unsecure_disable_tx_validation_on_addition)
|
||||
{
|
||||
uint64_t tx_fee = 0;
|
||||
CHECK_AND_ASSERT_MES(get_tx_fee(tx, tx_fee), false, "get_tx_fee failed");
|
||||
do_insert_transaction(tx, id, blob_size, kept_by_block, tx_fee, null_hash, 0);
|
||||
tvc.m_added_to_pool = true;
|
||||
tvc.m_should_be_relayed = true;
|
||||
tvc.m_verification_failed = false;
|
||||
tvc.m_verification_impossible = false;
|
||||
return true;
|
||||
}
|
||||
// ---------------- END OF UNSECURE CODE FOR TESTS -------------------
|
||||
|
||||
bool r = false;
|
||||
|
||||
// defaults
|
||||
|
|
|
|||
|
|
@ -143,6 +143,10 @@ namespace currency
|
|||
|
||||
bool is_tx_blacklisted(const crypto::hash& id) const;
|
||||
|
||||
#ifdef TX_POOL_USE_UNSECURE_TEST_FUNCTIONS
|
||||
void unsecure_disable_tx_validation_on_addition(bool validation_disabled) { m_unsecure_disable_tx_validation_on_addition = validation_disabled; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool on_tx_add(crypto::hash tx_id, const transaction& tx, bool kept_by_block);
|
||||
bool on_tx_remove(const crypto::hash &tx_id, const transaction& tx, bool kept_by_block);
|
||||
|
|
@ -197,6 +201,7 @@ namespace currency
|
|||
key_image_cache m_key_images;
|
||||
mutable epee::critical_section m_remove_stuck_txs_lock;
|
||||
|
||||
bool m_unsecure_disable_tx_validation_on_addition = false;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue