void fullnode::new_unconfirm_valid_tx( const std::error_code& ec, const index_list& unconfirmed, const transaction_type& tx) { auto handle_index = [](const std::error_code& ec) { if (ec) log_error() << "Index error: " << ec.message(); }; const hash_digest& tx_hash = hash_transaction(tx); if (ec) { log_warning() << "Error storing memory pool transaction " << tx_hash << ": " << ec.message(); } else { auto l = log_debug(); l << "Accepted transaction "; if (!unconfirmed.empty()) { l << "(Unconfirmed inputs"; for (auto idx: unconfirmed) l << " " << idx; l << ") "; } l << tx_hash; txidx_.index(tx, handle_index); } }
void handle_mempool_store( const std::error_code& ec, const index_list& unconfirmed, const transaction_type& tx, channel_ptr node) { const hash_digest& tx_hash = hash_transaction(tx); // Decided against this. Spammers can abuse us more easily. /*if (ec == error::input_not_found) { BITCOIN_ASSERT(unconfirmed.size() == 1); BITCOIN_ASSERT(unconfirmed[0] < tx.inputs.size()); const auto& prevout = tx.inputs[unconfirmed[0]].previous_output; log_info() << "Requesting dependency " << encode_hex(prevout.hash) << " for " << encode_hex(tx_hash); message::get_data getdat; getdat.inventories.push_back( {message::inventory_type::transaction, prevout.hash}); //getdat.inventories.push_back( // {message::inventory_type::transaction, tx_hash}); node->send(getdat, depends_requested); } else if (ec)*/ if (ec) { //BITCOIN_ASSERT(unconfirmed.size() == 0); log_error() << "Error storing memory pool transaction " << encode_hex(tx_hash) << ": " << ec.message(); } else { auto l = log_info(); l << "Accepted transaction "; if (!unconfirmed.empty()) { l << "(Unconfirmed inputs"; for (auto idx: unconfirmed) l << " " << idx; l << ") "; } l << encode_hex(tx_hash); } }
void transaction_pool::validation_complete( const std::error_code& ec, const index_list& unconfirmed, const hash_digest& tx_hash, validate_handler handle_validate) { if (ec == error::input_not_found || ec == error::validate_inputs_failed) { BITCOIN_ASSERT(unconfirmed.size() == 1); //BITCOIN_ASSERT(unconfirmed[0] < tx.inputs.size()); handle_validate(ec, unconfirmed); } else if (ec) { BITCOIN_ASSERT(unconfirmed.empty()); handle_validate(ec, index_list()); } // Re-check as another transaction might have been added in the interim. else if (tx_exists(tx_hash)) handle_validate(error::duplicate, index_list()); else handle_validate(bc::error::success, unconfirmed); }