Skip to content

Commit 9e95931

Browse files
committed
[wallet] Remove state argument from CWallet::CommitTransaction
The `state` return argument has not been set since commit 611291c. Remove it (and the one place that it's used in a calling function).
1 parent d1734f9 commit 9e95931

File tree

6 files changed

+8
-24
lines changed

6 files changed

+8
-24
lines changed

src/interfaces/wallet.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <interfaces/wallet.h>
66

77
#include <amount.h>
8-
#include <consensus/validation.h>
98
#include <interfaces/chain.h>
109
#include <interfaces/handler.h>
1110
#include <policy/feerate.h>
@@ -224,8 +223,7 @@ class WalletImpl : public Wallet
224223
{
225224
auto locked_chain = m_wallet->chain().lock();
226225
LOCK(m_wallet->cs_wallet);
227-
CValidationState state;
228-
m_wallet->CommitTransaction(std::move(tx), std::move(value_map), std::move(order_form), state);
226+
m_wallet->CommitTransaction(std::move(tx), std::move(value_map), std::move(order_form));
229227
}
230228
bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet->TransactionCanBeAbandoned(txid); }
231229
bool abandonTransaction(const uint256& txid) override

src/wallet/feebumper.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
#include <consensus/validation.h>
65
#include <interfaces/chain.h>
76
#include <wallet/coincontrol.h>
87
#include <wallet/feebumper.h>
@@ -393,17 +392,10 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransacti
393392
mapValue_t mapValue = oldWtx.mapValue;
394393
mapValue["replaces_txid"] = oldWtx.GetHash().ToString();
395394

396-
CValidationState state;
397-
wallet.CommitTransaction(tx, std::move(mapValue), oldWtx.vOrderForm, state);
398-
399-
bumped_txid = tx->GetHash();
400-
if (state.IsInvalid()) {
401-
// This can happen if the mempool rejected the transaction. Report
402-
// what happened in the "errors" response.
403-
errors.push_back(strprintf("Error: The transaction was rejected: %s", FormatStateMessage(state)));
404-
}
395+
wallet.CommitTransaction(tx, std::move(mapValue), oldWtx.vOrderForm);
405396

406397
// mark the original tx as bumped
398+
bumped_txid = tx->GetHash();
407399
if (!wallet.MarkReplaced(oldWtx.GetHash(), bumped_txid)) {
408400
// TODO: see if JSON-RPC has a standard way of returning a response
409401
// along with an exception. It would be good to return information about

src/wallet/rpcwallet.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

66
#include <amount.h>
7-
#include <consensus/validation.h>
87
#include <core_io.h>
98
#include <init.h>
109
#include <interfaces/chain.h>
@@ -342,8 +341,7 @@ static CTransactionRef SendMoney(interfaces::Chain::Lock& locked_chain, CWallet
342341
strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
343342
throw JSONRPCError(RPC_WALLET_ERROR, strError);
344343
}
345-
CValidationState state;
346-
pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state);
344+
pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */);
347345
return tx;
348346
}
349347

@@ -924,8 +922,7 @@ static UniValue sendmany(const JSONRPCRequest& request)
924922
bool fCreated = pwallet->CreateTransaction(*locked_chain, vecSend, tx, nFeeRequired, nChangePosRet, strFailReason, coin_control);
925923
if (!fCreated)
926924
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
927-
CValidationState state;
928-
pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state);
925+
pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */);
929926
return tx->GetHash().GetHex();
930927
}
931928

src/wallet/test/wallet_tests.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <stdint.h>
99
#include <vector>
1010

11-
#include <consensus/validation.h>
1211
#include <interfaces/chain.h>
1312
#include <policy/policy.h>
1413
#include <rpc/server.h>
@@ -451,8 +450,7 @@ class ListCoinsTestingSetup : public TestChain100Setup
451450
auto locked_chain = m_chain->lock();
452451
BOOST_CHECK(wallet->CreateTransaction(*locked_chain, {recipient}, tx, fee, changePos, error, dummy));
453452
}
454-
CValidationState state;
455-
wallet->CommitTransaction(tx, {}, {}, state);
453+
wallet->CommitTransaction(tx, {}, {});
456454
CMutableTransaction blocktx;
457455
{
458456
LOCK(wallet->cs_wallet);

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3286,7 +3286,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
32863286
return true;
32873287
}
32883288

3289-
void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm, CValidationState& state)
3289+
void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm)
32903290
{
32913291
auto locked_chain = chain().lock();
32923292
LOCK(cs_wallet);

src/wallet/wallet.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,9 +1155,8 @@ class CWallet final : public FillableSigningProvider, private interfaces::Chain:
11551155
* @param tx[in] The transaction to be broadcast.
11561156
* @param mapValue[in] key-values to be set on the transaction.
11571157
* @param orderForm[in] BIP 70 / BIP 21 order form details to be set on the transaction.
1158-
* @param state[in,out] CValidationState object returning information about whether the transaction was accepted
11591158
*/
1160-
void CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm, CValidationState& state);
1159+
void CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm);
11611160

11621161
bool DummySignTx(CMutableTransaction &txNew, const std::set<CTxOut> &txouts, bool use_max_sig = false) const
11631162
{

0 commit comments

Comments
 (0)