mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
[net processing] Move RelayTransaction into PeerManager
We don't mark RelayTransaction as const. Even though it doesn't mutate PeerManagerImpl state, it _is_ mutating the internal state of a CNode object, by updating setInventoryTxToSend. In a subsequent commit, that field will be moved to the Peer object, which is owned by PeerMangerImpl. This requires PeerManagerImpl::ReattemptInitialBroadcast() to no longer be const.
This commit is contained in:
@@ -32,6 +32,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
|
||||
// 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);
|
||||
assert(node.peerman);
|
||||
assert(node.mempool);
|
||||
std::promise<void> promise;
|
||||
uint256 hashTx = tx->GetHash();
|
||||
@@ -100,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(), *node.connman);
|
||||
}
|
||||
|
||||
return TransactionError::OK;
|
||||
|
||||
Reference in New Issue
Block a user