[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).
This commit is contained in:
John Newbery committed 2019-10-18 09:43:01 -04:00
1 parent d1734f9a3b
commit 9e95931865
6 files changed
+8 -24

No files matched your search

+1 -3
View File
@@ -5,7 +5,6 @@
#include <interfaces/wallet.h> #include <interfaces/wallet.h>
#include <amount.h> #include <amount.h>
#include <consensus/validation.h>
#include <interfaces/chain.h> #include <interfaces/chain.h>
#include <interfaces/handler.h> #include <interfaces/handler.h>
#include <policy/feerate.h> #include <policy/feerate.h>
@@ -224,8 +223,7 @@ public:
{ {
auto locked_chain = m_wallet->chain().lock(); auto locked_chain = m_wallet->chain().lock();
LOCK(m_wallet->cs_wallet); LOCK(m_wallet->cs_wallet);
CValidationState state; m_wallet->CommitTransaction(std::move(tx), std::move(value_map), std::move(order_form));
m_wallet->CommitTransaction(std::move(tx), std::move(value_map), std::move(order_form), state);
} }
bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet->TransactionCanBeAbandoned(txid); } bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet->TransactionCanBeAbandoned(txid); }
bool abandonTransaction(const uint256& txid) override bool abandonTransaction(const uint256& txid) override
+2 -10
View File
@@ -2,7 +2,6 @@
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <consensus/validation.h>
#include <interfaces/chain.h> #include <interfaces/chain.h>
#include <wallet/coincontrol.h> #include <wallet/coincontrol.h>
#include <wallet/feebumper.h> #include <wallet/feebumper.h>
@@ -393,17 +392,10 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransacti
mapValue_t mapValue = oldWtx.mapValue; mapValue_t mapValue = oldWtx.mapValue;
mapValue["replaces_txid"] = oldWtx.GetHash().ToString(); mapValue["replaces_txid"] = oldWtx.GetHash().ToString();
CValidationState state; wallet.CommitTransaction(tx, std::move(mapValue), oldWtx.vOrderForm);
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)));
}
// mark the original tx as bumped // mark the original tx as bumped
bumped_txid = tx->GetHash();
if (!wallet.MarkReplaced(oldWtx.GetHash(), bumped_txid)) { if (!wallet.MarkReplaced(oldWtx.GetHash(), bumped_txid)) {
// TODO: see if JSON-RPC has a standard way of returning a response // 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 // along with an exception. It would be good to return information about
+2 -5
View File
@@ -4,7 +4,6 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <amount.h> #include <amount.h>
#include <consensus/validation.h>
#include <core_io.h> #include <core_io.h>
#include <init.h> #include <init.h>
#include <interfaces/chain.h> #include <interfaces/chain.h>
@@ -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)); strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired));
throw JSONRPCError(RPC_WALLET_ERROR, strError); throw JSONRPCError(RPC_WALLET_ERROR, strError);
} }
CValidationState state; pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */);
pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state);
return tx; 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); bool fCreated = pwallet->CreateTransaction(*locked_chain, vecSend, tx, nFeeRequired, nChangePosRet, strFailReason, coin_control);
if (!fCreated) if (!fCreated)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason);
CValidationState state; pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */);
pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state);
return tx->GetHash().GetHex(); return tx->GetHash().GetHex();
} }
+1 -3
View File
@@ -8,7 +8,6 @@
#include <stdint.h> #include <stdint.h>
#include <vector> #include <vector>
#include <consensus/validation.h>
#include <interfaces/chain.h> #include <interfaces/chain.h>
#include <policy/policy.h> #include <policy/policy.h>
#include <rpc/server.h> #include <rpc/server.h>
@@ -451,8 +450,7 @@ public:
auto locked_chain = m_chain->lock(); auto locked_chain = m_chain->lock();
BOOST_CHECK(wallet->CreateTransaction(*locked_chain, {recipient}, tx, fee, changePos, error, dummy)); BOOST_CHECK(wallet->CreateTransaction(*locked_chain, {recipient}, tx, fee, changePos, error, dummy));
} }
CValidationState state; wallet->CommitTransaction(tx, {}, {});
wallet->CommitTransaction(tx, {}, {}, state);
CMutableTransaction blocktx; CMutableTransaction blocktx;
{ {
LOCK(wallet->cs_wallet); LOCK(wallet->cs_wallet);
+1 -1
View File
@@ -3286,7 +3286,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
return true; return true;
} }
void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm, CValidationState& state) void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm)
{ {
auto locked_chain = chain().lock(); auto locked_chain = chain().lock();
LOCK(cs_wallet); LOCK(cs_wallet);
+1 -2
View File
@@ -1155,9 +1155,8 @@ public:
* @param tx[in] The transaction to be broadcast. * @param tx[in] The transaction to be broadcast.
* @param mapValue[in] key-values to be set on the transaction. * @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 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<std::pair<std::string, std::string>> orderForm, CValidationState& state); void CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector<std::pair<std::string, std::string>> orderForm);
bool DummySignTx(CMutableTransaction &txNew, const std::set<CTxOut> &txouts, bool use_max_sig = false) const bool DummySignTx(CMutableTransaction &txNew, const std::set<CTxOut> &txouts, bool use_max_sig = false) const
{ {