From 9e95931865186d7a9a6dc54b64bd96507e9fea4b Mon Sep 17 00:00:00 2001 From: John Newbery Date: Fri, 18 Oct 2019 09:37:40 -0400 Subject: [wallet] Remove `state` argument from CWallet::CommitTransaction The `state` return argument has not been set since commit 611291c198. Remove it (and the one place that it's used in a calling function). --- src/wallet/feebumper.cpp | 12 ++---------- src/wallet/rpcwallet.cpp | 7 ++----- src/wallet/test/wallet_tests.cpp | 4 +--- src/wallet/wallet.cpp | 2 +- src/wallet/wallet.h | 3 +-- 5 files changed, 7 insertions(+), 21 deletions(-) (limited to 'src/wallet') diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp index c9cd042b03..0a4bb3f396 100644 --- a/src/wallet/feebumper.cpp +++ b/src/wallet/feebumper.cpp @@ -2,7 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include #include #include #include @@ -393,17 +392,10 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransacti mapValue_t mapValue = oldWtx.mapValue; mapValue["replaces_txid"] = oldWtx.GetHash().ToString(); - CValidationState state; - wallet.CommitTransaction(tx, std::move(mapValue), oldWtx.vOrderForm, state); - - bumped_txid = tx->GetHash(); - if (state.IsInvalid()) { - // This can happen if the mempool rejected the transaction. Report - // what happened in the "errors" response. - errors.push_back(strprintf("Error: The transaction was rejected: %s", FormatStateMessage(state))); - } + wallet.CommitTransaction(tx, std::move(mapValue), oldWtx.vOrderForm); // mark the original tx as bumped + bumped_txid = tx->GetHash(); if (!wallet.MarkReplaced(oldWtx.GetHash(), bumped_txid)) { // TODO: see if JSON-RPC has a standard way of returning a response // along with an exception. It would be good to return information about diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 62066ddcc7..35d550a2e3 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4,7 +4,6 @@ // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include -#include #include #include #include @@ -342,8 +341,7 @@ static CTransactionRef SendMoney(interfaces::Chain::Lock& locked_chain, CWallet strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired)); throw JSONRPCError(RPC_WALLET_ERROR, strError); } - CValidationState state; - pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state); + pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */); return tx; } @@ -924,8 +922,7 @@ static UniValue sendmany(const JSONRPCRequest& request) bool fCreated = pwallet->CreateTransaction(*locked_chain, vecSend, tx, nFeeRequired, nChangePosRet, strFailReason, coin_control); if (!fCreated) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); - CValidationState state; - pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state); + pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */); return tx->GetHash().GetHex(); } diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index f31cd1e1b6..a2b2a7b227 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -451,8 +450,7 @@ public: auto locked_chain = m_chain->lock(); BOOST_CHECK(wallet->CreateTransaction(*locked_chain, {recipient}, tx, fee, changePos, error, dummy)); } - CValidationState state; - wallet->CommitTransaction(tx, {}, {}, state); + wallet->CommitTransaction(tx, {}, {}); CMutableTransaction blocktx; { LOCK(wallet->cs_wallet); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9c5de45c28..413013e32e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3286,7 +3286,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std return true; } -void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector> orderForm, CValidationState& state) +void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector> orderForm) { auto locked_chain = chain().lock(); LOCK(cs_wallet); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 8113e60aa6..c7834a5d02 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1155,9 +1155,8 @@ public: * @param tx[in] The transaction to be broadcast. * @param mapValue[in] key-values to be set on the transaction. * @param orderForm[in] BIP 70 / BIP 21 order form details to be set on the transaction. - * @param state[in,out] CValidationState object returning information about whether the transaction was accepted */ - void CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector> orderForm, CValidationState& state); + void CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector> orderForm); bool DummySignTx(CMutableTransaction &txNew, const std::set &txouts, bool use_max_sig = false) const { -- cgit v1.2.3