From b8cc6d46bdd4d916064c4678580eca91918bf82e Mon Sep 17 00:00:00 2001 From: warptangent Date: Thu, 28 Jan 2016 16:43:00 -0800 Subject: [PATCH] BlockchainBDB: Continue when tx has no outputs See 24b66243c2767726ea4b279fcf447c7cd82c13e5 --- src/blockchain_db/berkeleydb/db_bdb.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index 46e12af88..832fb8f8d 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -354,9 +354,11 @@ void BlockchainBDB::remove_transaction_data(const crypto::hash& tx_hash, const t remove_tx_outputs(tx_hash, tx); - if (m_tx_outputs->del(DB_DEFAULT_TX, &val_h, 0)) + auto result = m_tx_outputs->del(DB_DEFAULT_TX, &val_h, 0); + if (result == DB_NOTFOUND) + LOG_PRINT_L1("tx has no outputs to remove: " << tx_hash); + else if (result) throw1(DB_ERROR("Failed to add removal of tx outputs to db transaction")); - } void BlockchainBDB::add_output(const crypto::hash& tx_hash, const tx_out& tx_output, const uint64_t& local_index, const uint64_t unlock_time) @@ -411,7 +413,7 @@ void BlockchainBDB::remove_tx_outputs(const crypto::hash& tx_hash, const transac auto result = cur->get(&k, &v, DB_SET); if (result == DB_NOTFOUND) { - throw0(OUTPUT_DNE("Attempting to remove a tx's outputs, but none found.")); + LOG_PRINT_L2("tx has no outputs, so no global output indices"); } else if (result) {