From cb79b9dbf4cd06e17c8c65b36bf15c3ea2641de4 Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Mon, 27 Jul 2020 21:30:50 -0700 Subject: [mempool] Revert unbroadcast set to tracking just txid When I originally implemented the unbroadcast set in 18038, it just tracked txids. After 18038 was merged, I offered a patch to 18044 to make the unbroadcast changes compatible with wtxid relay. In this patch, I updated `unbroadcast_txids` to a map of txid -> wtxid. Post merge review comments shed light on the fact that this update was unnecessary, and distracting. So, this commit updates the unbroadcast ids back to a set. --- src/node/transaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/node') diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 5633abe817..586bc8d2a9 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -80,7 +80,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t if (relay) { // the mempool tracks locally submitted transactions to make a // best-effort of initial broadcast - node.mempool->AddUnbroadcastTx(hashTx, tx->GetWitnessHash()); + node.mempool->AddUnbroadcastTx(hashTx); LOCK(cs_main); RelayTransaction(hashTx, tx->GetWitnessHash(), *node.connman); -- cgit v1.2.3 From a8a64acaf32ac21feeb885671772282b531ef9a2 Mon Sep 17 00:00:00 2001 From: Amiti Uttarwar Date: Tue, 25 Aug 2020 10:49:38 -0700 Subject: [BroadcastTransaction] Remove unsafe move operator Previously, `tx` was being read after having `std::move` called on it. The std::move operator indicates to the compiler that this object may be "moved from", so we shouldn't subsequently read from it. The current code is not problematic since tx is passed in as a const ref. But this `std::move` is at best misleading & at worst problematic, so remove it. --- src/node/transaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/node') diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 586bc8d2a9..9ae4700743 100644 --- a/src/node/transaction.cpp +++ b/src/node/transaction.cpp @@ -38,8 +38,8 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t if (!node.mempool->exists(hashTx)) { // Transaction is not already in the mempool. Submit it. TxValidationState state; - if (!AcceptToMemoryPool(*node.mempool, state, std::move(tx), - nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) { + if (!AcceptToMemoryPool(*node.mempool, state, tx, + nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) { err_string = state.ToString(); if (state.IsInvalid()) { if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) { -- cgit v1.2.3