Skip to content

Commit 96dfe5c

Browse files
committed
refactor: Change Chain::broadcastTransaction param order
Make output argument last argument so it works more easily with IPC framework in #10102, and for consistency with other methods
1 parent 6ceb219 commit 96dfe5c

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/interfaces/chain.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ class ChainImpl : public Chain
278278
auto it = ::mempool.GetIter(txid);
279279
return it && (*it)->GetCountWithDescendants() > 1;
280280
}
281-
bool broadcastTransaction(const CTransactionRef& tx, std::string& err_string, const CAmount& max_tx_fee, bool relay) override
281+
bool broadcastTransaction(const CTransactionRef& tx,
282+
const CAmount& max_tx_fee,
283+
bool relay,
284+
std::string& err_string) override
282285
{
283286
const TransactionError err = BroadcastTransaction(m_node, tx, err_string, max_tx_fee, relay, /*wait_callback*/ false);
284287
// Chain clients only care about failures to accept the tx to the mempool. Disregard non-mempool related failures.

src/interfaces/chain.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@ class Chain
154154
//! Transaction is added to memory pool, if the transaction fee is below the
155155
//! amount specified by max_tx_fee, and broadcast to all peers if relay is set to true.
156156
//! Return false if the transaction could not be added due to the fee or for another reason.
157-
virtual bool broadcastTransaction(const CTransactionRef& tx, std::string& err_string, const CAmount& max_tx_fee, bool relay) = 0;
157+
virtual bool broadcastTransaction(const CTransactionRef& tx,
158+
const CAmount& max_tx_fee,
159+
bool relay,
160+
std::string& err_string) = 0;
158161

159162
//! Calculate mempool ancestor and descendant counts for the given transaction.
160163
virtual void getTransactionAncestry(const uint256& txid, size_t& ancestors, size_t& descendants) = 0;

src/wallet/wallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ bool CWalletTx::SubmitMemoryPoolAndRelay(std::string& err_string, bool relay)
17851785
// Irrespective of the failure reason, un-marking fInMempool
17861786
// out-of-order is incorrect - it should be unmarked when
17871787
// TransactionRemovedFromMempool fires.
1788-
bool ret = pwallet->chain().broadcastTransaction(tx, err_string, pwallet->m_default_max_tx_fee, relay);
1788+
bool ret = pwallet->chain().broadcastTransaction(tx, pwallet->m_default_max_tx_fee, relay, err_string);
17891789
fInMempool |= ret;
17901790
return ret;
17911791
}

0 commit comments

Comments
 (0)