diff options
author | John Newbery <john@johnnewbery.com> | 2021-01-27 22:05:13 +0000 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-03-04 10:22:42 +0000 |
commit | a38a4e8f039dfabfd9435f3a63f1a9b56de086d6 (patch) | |
tree | 9f87f4c3a904001bb1b5326b4de3333c78c2c330 /src/node | |
parent | 92b7efcf54d3154e4b31c9a6eae60f27e349f45e (diff) |
[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.
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/transaction.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 3b3fab7b6b..b01381411a 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -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; |