diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index ecba717b45d..30d4c10915f 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -157,16 +157,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& errors, CAmount& old_fee, @@ -177,28 +177,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& 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 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, diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 42a0479576c..7baa692b784 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -561,15 +561,11 @@ bool WalletModel::bumpFee(Txid hash, Txid& new_hash) return false; } // commit the bumped transaction - // Temporary uint256 variable needed for commitBumpTransaction out parameter. - uint256 bumped_txid_result; - if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, bumped_txid_result)) { + if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, new_hash)) { QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Could not commit transaction") + "
(" + QString::fromStdString(errors[0].translated)+")"); return false; } - // Assign the received txid back to the new_hash. - new_hash = Txid::FromUint256(bumped_txid_result); return true; } diff --git a/src/wallet/feebumper.cpp b/src/wallet/feebumper.cpp index 0a58285a969..f1ee7a215b8 100644 --- a/src/wallet/feebumper.cpp +++ b/src/wallet/feebumper.cpp @@ -348,7 +348,7 @@ bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx) { } } -Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransaction&& mtx, std::vector& errors, uint256& bumped_txid) +Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransaction&& mtx, std::vector& errors, Txid& bumped_txid) { LOCK(wallet.cs_wallet); if (!errors.empty()) { diff --git a/src/wallet/feebumper.h b/src/wallet/feebumper.h index d3d43861efc..439ec96bb11 100644 --- a/src/wallet/feebumper.h +++ b/src/wallet/feebumper.h @@ -70,7 +70,7 @@ Result CommitTransaction(CWallet& wallet, const uint256& txid, CMutableTransaction&& mtx, std::vector& errors, - uint256& bumped_txid); + Txid& bumped_txid); struct SignatureWeights { diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index 08daba3d2e8..c13f0b8cf2a 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -291,17 +291,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& errors, CAmount& old_fee, @@ -312,15 +312,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& 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); @@ -329,7 +329,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); @@ -347,7 +347,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 @@ -366,7 +366,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, diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp index a59d274b176..7414b8ace42 100644 --- a/src/wallet/rpc/spend.cpp +++ b/src/wallet/rpc/spend.cpp @@ -1166,7 +1166,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name) throw JSONRPCError(RPC_WALLET_ERROR, "Can't sign transaction."); } - uint256 txid; + Txid txid; if (feebumper::CommitTransaction(*pwallet, hash, std::move(mtx), errors, txid) != feebumper::Result::OK) { throw JSONRPCError(RPC_WALLET_ERROR, errors[0].original); }