mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge #17154: wallet: Remove return value from CommitTransaction
9e95931865[wallet] Remove `state` argument from CWallet::CommitTransaction (John Newbery)d1734f9a3b[wallet] Remove return value from CommitTransaction() (John Newbery)b6f486a02b[wallet] Add doxygen comment to CWallet::CommitTransaction() (John Newbery)8bba91b22d[wallet] Fix whitespace in CWallet::CommitTransaction() (John Newbery) Pull request description: `CommitTransaction()` returns a bool to indicate success, but since commitb3a7410(#9302) 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. Two additional commits fix up the idiosyncratic whitespace in `CommitTransaction` and add a doxygen comment for the function. ACKs for top commit: laanwj: ACK9e95931865Tree-SHA512: a55a2c20369a45222fc0e02d0891495655a926e71c4f52cb72624768dd7b9c1dca716ea67d38420afb90f40c6e0fd448caa60c18fd693bb10ecb110b641820e6
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include <interfaces/wallet.h>
|
||||
|
||||
#include <amount.h>
|
||||
#include <consensus/validation.h>
|
||||
#include <interfaces/chain.h>
|
||||
#include <interfaces/handler.h>
|
||||
#include <policy/fees.h>
|
||||
@@ -216,19 +215,13 @@ public:
|
||||
}
|
||||
return tx;
|
||||
}
|
||||
bool commitTransaction(CTransactionRef tx,
|
||||
void commitTransaction(CTransactionRef tx,
|
||||
WalletValueMap value_map,
|
||||
WalletOrderForm order_form,
|
||||
std::string& reject_reason) override
|
||||
WalletOrderForm order_form) override
|
||||
{
|
||||
auto locked_chain = m_wallet->chain().lock();
|
||||
LOCK(m_wallet->cs_wallet);
|
||||
CValidationState state;
|
||||
if (!m_wallet->CommitTransaction(std::move(tx), std::move(value_map), std::move(order_form), state)) {
|
||||
reject_reason = state.GetRejectReason();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
m_wallet->CommitTransaction(std::move(tx), std::move(value_map), std::move(order_form));
|
||||
}
|
||||
bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet->TransactionCanBeAbandoned(txid); }
|
||||
bool abandonTransaction(const uint256& txid) override
|
||||
|
||||
@@ -141,10 +141,9 @@ public:
|
||||
std::string& fail_reason) = 0;
|
||||
|
||||
//! Commit transaction.
|
||||
virtual bool commitTransaction(CTransactionRef tx,
|
||||
virtual void commitTransaction(CTransactionRef tx,
|
||||
WalletValueMap value_map,
|
||||
WalletOrderForm order_form,
|
||||
std::string& reject_reason) = 0;
|
||||
WalletOrderForm order_form) = 0;
|
||||
|
||||
//! Return whether transaction can be abandoned.
|
||||
virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;
|
||||
|
||||
Reference in New Issue
Block a user