mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
Merge #21162: Net Processing: Move RelayTransaction() into PeerManager
680eb56d82[net processing] Don't pass CConnman to RelayTransactions (John Newbery)a38a4e8f03[net processing] Move RelayTransaction into PeerManager (John Newbery) Pull request description: This is the first part of #21160. It moves the RelayTransaction() function to be a member function of the PeerManager class. This is required in order to move the transaction inventory data into the Peer object, since Peer objects are only accessible from within PeerManager. ACKs for top commit: ajtowns: ACK680eb56d82Tree-SHA512: 8c93491a4392b6369bb7f090de326a63cd62a088de59026e202f226f64ded50a0cf1a95ed703328860f02a9d2f64d3a87ca1bca9a6075b978bd111d384766235
This commit is contained in:
@@ -29,9 +29,9 @@ static TransactionError HandleATMPError(const TxValidationState& state, std::str
|
||||
TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef tx, std::string& err_string, const CAmount& max_tx_fee, bool relay, bool wait_callback)
|
||||
{
|
||||
// BroadcastTransaction can be called by either sendrawtransaction RPC or wallet RPCs.
|
||||
// node.connman is assigned both before chain clients and before RPC server is accepting calls,
|
||||
// and reset after chain clients and RPC sever are stopped. node.connman should never be null here.
|
||||
assert(node.connman);
|
||||
// node.peerman is assigned both before chain clients and before RPC server is accepting calls,
|
||||
// and reset after chain clients and RPC sever are stopped. node.peerman should never be null here.
|
||||
assert(node.peerman);
|
||||
assert(node.mempool);
|
||||
std::promise<void> promise;
|
||||
uint256 hashTx = tx->GetHash();
|
||||
@@ -101,7 +101,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
|
||||
node.mempool->AddUnbroadcastTx(hashTx);
|
||||
|
||||
LOCK(cs_main);
|
||||
RelayTransaction(hashTx, tx->GetWitnessHash(), *node.connman);
|
||||
node.peerman->RelayTransaction(hashTx, tx->GetWitnessHash());
|
||||
}
|
||||
|
||||
return TransactionError::OK;
|
||||
|
||||
Reference in New Issue
Block a user