Skip to content

Commit a8a64ac

Browse files
committed
[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.
1 parent 125c038 commit a8a64ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node/transaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
3838
if (!node.mempool->exists(hashTx)) {
3939
// Transaction is not already in the mempool. Submit it.
4040
TxValidationState state;
41-
if (!AcceptToMemoryPool(*node.mempool, state, std::move(tx),
42-
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) {
41+
if (!AcceptToMemoryPool(*node.mempool, state, tx,
42+
nullptr /* plTxnReplaced */, false /* bypass_limits */, max_tx_fee)) {
4343
err_string = state.ToString();
4444
if (state.IsInvalid()) {
4545
if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) {

0 commit comments

Comments
 (0)