void transaction_validated( const std::error_code& ec, const index_list& unconfirmed, const incoming_message& request, queue_send_callback queue_send) { data_chunk result(4 + unconfirmed.size() * 4); auto serial = make_serializer(result.begin()); write_error_code(serial, ec); BITCOIN_ASSERT(serial.iterator() == result.begin() + 4); for (uint32_t unconfirm_index: unconfirmed) serial.write_4_bytes(unconfirm_index); BITCOIN_ASSERT(serial.iterator() == result.end()); log_debug(LOG_WORKER) << "transaction_pool.validate() finished. Sending response: " << "ec=" << ec.message(); outgoing_message response(request, result); queue_send(response); }
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); }