wallet, refactor: Convert uint256 to Txid in wallet interfaces

This commit is contained in:
marcofleon 2025-03-28 16:51:31 +00:00
parent cf6f102cd3
commit ff88abdaa7
2 changed files with 20 additions and 20 deletions

View file

@ -159,16 +159,16 @@ public:
WalletOrderForm order_form) = 0;
//! Return whether transaction can be abandoned.
virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;
virtual bool transactionCanBeAbandoned(const Txid& txid) = 0;
//! Abandon transaction.
virtual bool abandonTransaction(const uint256& txid) = 0;
virtual bool abandonTransaction(const Txid& txid) = 0;
//! Return whether transaction can be bumped.
virtual bool transactionCanBeBumped(const uint256& txid) = 0;
virtual bool transactionCanBeBumped(const Txid& txid) = 0;
//! Create bump transaction.
virtual bool createBumpTransaction(const uint256& txid,
virtual bool createBumpTransaction(const Txid& txid,
const wallet::CCoinControl& coin_control,
std::vector<bilingual_str>& errors,
CAmount& old_fee,
@ -179,28 +179,28 @@ public:
virtual bool signBumpTransaction(CMutableTransaction& mtx) = 0;
//! Commit bump transaction.
virtual bool commitBumpTransaction(const uint256& txid,
virtual bool commitBumpTransaction(const Txid& txid,
CMutableTransaction&& mtx,
std::vector<bilingual_str>& errors,
uint256& bumped_txid) = 0;
Txid& bumped_txid) = 0;
//! Get a transaction.
virtual CTransactionRef getTx(const uint256& txid) = 0;
virtual CTransactionRef getTx(const Txid& txid) = 0;
//! Get transaction information.
virtual WalletTx getWalletTx(const uint256& txid) = 0;
virtual WalletTx getWalletTx(const Txid& txid) = 0;
//! Get list of all wallet transactions.
virtual std::set<WalletTx> getWalletTxs() = 0;
//! Try to get updated status for a particular transaction, if possible without blocking.
virtual bool tryGetTxStatus(const uint256& txid,
virtual bool tryGetTxStatus(const Txid& txid,
WalletTxStatus& tx_status,
int& num_blocks,
int64_t& block_time) = 0;
//! Get transaction details.
virtual WalletTx getWalletTxDetails(const uint256& txid,
virtual WalletTx getWalletTxDetails(const Txid& txid,
WalletTxStatus& tx_status,
WalletOrderForm& order_form,
bool& in_mempool,

View file

@ -299,17 +299,17 @@ public:
LOCK(m_wallet->cs_wallet);
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
bool transactionCanBeAbandoned(const Txid& txid) override { return m_wallet->TransactionCanBeAbandoned(txid); }
bool abandonTransaction(const Txid& txid) override
{
LOCK(m_wallet->cs_wallet);
return m_wallet->AbandonTransaction(txid);
}
bool transactionCanBeBumped(const uint256& txid) override
bool transactionCanBeBumped(const Txid& txid) override
{
return feebumper::TransactionCanBeBumped(*m_wallet.get(), txid);
}
bool createBumpTransaction(const uint256& txid,
bool createBumpTransaction(const Txid& txid,
const CCoinControl& coin_control,
std::vector<bilingual_str>& errors,
CAmount& old_fee,
@ -320,15 +320,15 @@ public:
return feebumper::CreateRateBumpTransaction(*m_wallet.get(), txid, coin_control, errors, old_fee, new_fee, mtx, /* require_mine= */ true, outputs) == feebumper::Result::OK;
}
bool signBumpTransaction(CMutableTransaction& mtx) override { return feebumper::SignTransaction(*m_wallet.get(), mtx); }
bool commitBumpTransaction(const uint256& txid,
bool commitBumpTransaction(const Txid& txid,
CMutableTransaction&& mtx,
std::vector<bilingual_str>& errors,
uint256& bumped_txid) override
Txid& bumped_txid) override
{
return feebumper::CommitTransaction(*m_wallet.get(), txid, std::move(mtx), errors, bumped_txid) ==
feebumper::Result::OK;
}
CTransactionRef getTx(const uint256& txid) override
CTransactionRef getTx(const Txid& txid) override
{
LOCK(m_wallet->cs_wallet);
auto mi = m_wallet->mapWallet.find(txid);
@ -337,7 +337,7 @@ public:
}
return {};
}
WalletTx getWalletTx(const uint256& txid) override
WalletTx getWalletTx(const Txid& txid) override
{
LOCK(m_wallet->cs_wallet);
auto mi = m_wallet->mapWallet.find(txid);
@ -355,7 +355,7 @@ public:
}
return result;
}
bool tryGetTxStatus(const uint256& txid,
bool tryGetTxStatus(const Txid& txid,
interfaces::WalletTxStatus& tx_status,
int& num_blocks,
int64_t& block_time) override
@ -374,7 +374,7 @@ public:
tx_status = MakeWalletTxStatus(*m_wallet, mi->second);
return true;
}
WalletTx getWalletTxDetails(const uint256& txid,
WalletTx getWalletTxDetails(const Txid& txid,
WalletTxStatus& tx_status,
WalletOrderForm& order_form,
bool& in_mempool,