diff options
author | John Newbery <john@johnnewbery.com> | 2019-04-03 17:55:24 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2019-10-18 09:26:32 -0400 |
commit | d1734f9a3b138ab046f38ee44a09bc3847bf938a (patch) | |
tree | 172eb76ab4c70e926fe292d8e535cae48ee879fc /src/wallet/rpcwallet.cpp | |
parent | b6f486a02b463ffeaf82ec11fc6f74f439c037ae (diff) | |
download | bitcoin-d1734f9a3b138ab046f38ee44a09bc3847bf938a.tar.xz |
[wallet] Remove return value from CommitTransaction()
CommitTransaction returns a bool to indicate success, but since commit
b3a74100b8 it only returns true, even if the transaction was not
successfully broadcast. This commit changes CommitTransaction() to return
void.
All dead code in `if (!CommitTransaction())` branches has been removed.
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index debc3fecda..62066ddcc7 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -343,10 +343,7 @@ static CTransactionRef SendMoney(interfaces::Chain::Lock& locked_chain, CWallet throw JSONRPCError(RPC_WALLET_ERROR, strError); } CValidationState state; - if (!pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state)) { - strError = strprintf("Error: The transaction was rejected! Reason given: %s", FormatStateMessage(state)); - throw JSONRPCError(RPC_WALLET_ERROR, strError); - } + pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state); return tx; } @@ -928,11 +925,7 @@ static UniValue sendmany(const JSONRPCRequest& request) if (!fCreated) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); CValidationState state; - if (!pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state)) { - strFailReason = strprintf("Transaction commit failed:: %s", FormatStateMessage(state)); - throw JSONRPCError(RPC_WALLET_ERROR, strFailReason); - } - + pwallet->CommitTransaction(tx, std::move(mapValue), {} /* orderForm */, state); return tx->GetHash().GetHex(); } |