void transaction_pool::handle_validated(const code& ec, const transaction& tx, const hash_digest& hash, const point::indexes& unconfirmed, validate_handler handler) { if (stopped()) { handler(error::service_stopped, tx, hash, {}); return; } if (ec == error::input_not_found || ec == error::validate_inputs_failed) { BITCOIN_ASSERT(unconfirmed.size() == 1); handler(ec, tx, hash, unconfirmed); return; } if (ec) { BITCOIN_ASSERT(unconfirmed.empty()); handler(ec, tx, hash, {}); return; } // Recheck the memory pool, as a duplicate may have been added. if (is_in_pool(hash)) handler(error::duplicate, tx, hash, {}); else handler(error::success, tx, hash, unconfirmed); }
void transaction_pool::handle_validated(const code& ec, const transaction& tx, const hash_digest& tx_hash, const point::indexes& unconfirmed, const message& request, send_handler handler) { // [ code:4 ] // [[ unconfirmed_index:4 ]...] data_chunk result(code_size + unconfirmed.size() * index_size); auto serial = make_serializer(result.begin()); serial.write_error_code(ec); for (const auto unconfirmed_index: unconfirmed) { BITCOIN_ASSERT(unconfirmed_index <= max_uint32); const auto index32 = static_cast<uint32_t>(unconfirmed_index); serial.write_4_bytes_little_endian(index32); } handler(message(request, result)); }