merge bitcoin#23499: Add interfaces::Node::broadCastTransaction method

This commit is contained in:
Kittywhiskers Van Gogh 2021-11-12 15:20:53 -05:00
parent 25c3355053
commit 06bf649e1b
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
3 changed files with 10 additions and 2 deletions

View File

@ -35,6 +35,7 @@ class UniValue;
class Proxy;
struct bilingual_str;
enum class SynchronizationState;
enum class TransactionError;
struct CNodeStateStats;
struct NodeContext;
@ -264,6 +265,9 @@ public:
//! Get unspent outputs associated with a transaction.
virtual bool getUnspentOutput(const COutPoint& output, Coin& coin) = 0;
//! Broadcast transaction.
virtual TransactionError broadcastTransaction(CTransactionRef tx, CAmount max_tx_fee, bilingual_str& err_string) = 0;
//! Get wallet loader.
virtual WalletLoader& walletLoader() = 0;

View File

@ -496,6 +496,10 @@ public:
LOCK(::cs_main);
return chainman().ActiveChainstate().CoinsTip().GetCoin(output, coin);
}
TransactionError broadcastTransaction(CTransactionRef tx, CAmount max_tx_fee, bilingual_str& err_string) override
{
return BroadcastTransaction(*m_context, std::move(tx), err_string, max_tx_fee, /*relay=*/ true, /*wait_callback=*/ false);
}
WalletLoader& walletLoader() override
{
return *Assert(m_context->wallet_loader);

View File

@ -108,8 +108,8 @@ void PSBTOperationsDialog::broadcastTransaction()
CTransactionRef tx = MakeTransactionRef(mtx);
bilingual_str err_string;
TransactionError error = BroadcastTransaction(
*m_client_model->node().context(), tx, err_string, DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK(), /* relay */ true, /* await_callback */ false);
TransactionError error =
m_client_model->node().broadcastTransaction(tx, DEFAULT_MAX_RAW_TX_FEE_RATE.GetFeePerK(), err_string);
if (error == TransactionError::OK) {
showStatus(tr("Transaction broadcast successfully! Transaction ID: %1")