diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2017-03-03 16:15:47 +0100 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2017-04-02 10:12:39 +0200 |
commit | 0337a39d31603eb2c723a560410357f186763dc2 (patch) | |
tree | 82076d4859da26c9bb890538acedcbbc232f6ac6 /src/wallet/wallet.cpp | |
parent | d1a95e8d3d0ac58792fe1b885c9fc65af11d7691 (diff) | |
download | bitcoin-0337a39d31603eb2c723a560410357f186763dc2.tar.xz |
Refactor Bumpfee core functionality
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 68d4bc35ee..186d3c5cd3 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -16,6 +16,7 @@ #include "validation.h" #include "net.h" #include "policy/policy.h" +#include "policy/rbf.h" #include "primitives/block.h" #include "primitives/transaction.h" #include "script/script.h" @@ -2255,6 +2256,26 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm return res; } +bool CWallet::SignTransaction(CMutableTransaction &tx) +{ + // sign the new tx + CTransaction txNewConst(tx); + int nIn = 0; + for (auto& input : tx.vin) { + std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(input.prevout.hash); + assert(mi != mapWallet.end() && input.prevout.n < mi->second.tx->vout.size()); + const CScript& scriptPubKey = mi->second.tx->vout[input.prevout.n].scriptPubKey; + const CAmount& amount = mi->second.tx->vout[input.prevout.n].nValue; + SignatureData sigdata; + if (!ProduceSignature(TransactionSignatureCreator(this, &txNewConst, nIn, amount, SIGHASH_ALL), scriptPubKey, sigdata)) { + return false; + } + UpdateTransaction(tx, nIn, sigdata); + nIn++; + } + return true; +} + bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, bool overrideEstimatedFeeRate, const CFeeRate& specificFeeRate, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, bool lockUnspents, const std::set<int>& setSubtractFeeFromOutputs, bool keepReserveKey, const CTxDestination& destChange) { std::vector<CRecipient> vecSend; |