diff options
| author | Amiti Uttarwar <[email protected]> | 2020-08-25 10:49:38 -0700 |
|---|---|---|
| committer | Amiti Uttarwar <[email protected]> | 2020-09-04 14:42:59 -0700 |
| commit | a8a64acaf32ac21feeb885671772282b531ef9a2 (patch) | |
| tree | 3c470d1029df55eeb3411e08485fa6f43a0372dc /src | |
| parent | [p2p] Remove dead code (diff) | |
| download | discoin-a8a64acaf32ac21feeb885671772282b531ef9a2.tar.xz discoin-a8a64acaf32ac21feeb885671772282b531ef9a2.zip | |
[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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/node/transaction.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp index 586bc8d2a..9ae470074 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) { |