Skip to content

Commit

Permalink
remove accept function from loadTx()
Browse files Browse the repository at this point in the history
  • Loading branch information
SNeedlewoods committed Sep 23, 2024
1 parent 0daaeec commit 4291ce0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/wallet/api/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,7 @@ bool WalletImpl::submitTransaction(const string &fileName) {
return false;
std::unique_ptr<PendingTransactionImpl> transaction(new PendingTransactionImpl(*this));

// TODO : use WalletImpl::loadTx() if ready
bool r = m_wallet->load_tx(fileName, transaction->m_pending_tx);
bool r = m_wallet->loadTx(fileName, transaction);
if (!r) {
setStatus(Status_Ok, tr("Failed to load transaction from file"));
return false;
Expand Down Expand Up @@ -3228,6 +3227,11 @@ std::string WalletImpl::signTxToStr(const UnsignedTransaction &exported_txs, Pen
return signed_tx_data;
}
//-------------------------------------------------------------------------------------------------------------------
bool WalletImpl::loadTx(const std::string &signed_filename, PendingTransaction &ptx) const
{
return m_wallet->load_tx(signed_filename, ptx.m_pending_tx);
}
//-------------------------------------------------------------------------------------------------------------------
bool WalletImpl::parseMultisigTxFromStr(const std::string &multisig_tx_str, PendingTransaction &exported_txs) const
{
clearStatus();
Expand Down
1 change: 1 addition & 0 deletions src/wallet/api/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class WalletImpl : public Wallet
std::string convertTxToStr(const PendingTransaction &ptxs) const override;
bool parseUnsignedTxFromStr(const std::string &unsigned_tx_str, UnsignedTransaction &exported_txs) const override;
std::string signTxToStr(const UnsignedTransaction &exported_txs, PendingTransaction &ptx) const override;
bool loadTx(const std::string &signed_filename, PendingTransaction &ptx) const override;
bool parseMultisigTxFromStr(const std::string &multisig_tx_str, PendingTransaction &exported_txs) const override;
std::uint64_t getFeeMultiplier(std::uint32_t priority, int fee_algorithm) const override;
std::uint64_t getBaseFee() const override;
Expand Down
5 changes: 2 additions & 3 deletions src/wallet/api/wallet2_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1351,15 +1351,14 @@ struct Wallet
* note: sets status error on fail
*/
virtual std::string signTxToStr(const UnsignedTransaction &exported_txs, PendingTransaction &ptx) const = 0;
// TODO : accept_func with wallet2::signed_tx_set
// TODO : if it's fine to drop the accept_func, do it for all the functions below
/**
* brief: loadTx - load pending transactions from a file
* param: signed_filename -
* outparam: ptx -
* param: accept_func - callback function to verify the transaction
* return: true if succeeded
*/
// virtual bool loadTx(const std::string &signed_filename, PendingTransaction &ptx, std::function<bool(const signed_tx_set&)> accept_func) const = 0;
virtual bool loadTx(const std::string &signed_filename, PendingTransaction &ptx) const = 0;
// TODO : accept_func with wallet2::signed_tx_set
/**
* brief: parseTxFromStr - get transactions from encrypted signed transaction as hex string
Expand Down

0 comments on commit 4291ce0

Please sign in to comment.