aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2020-02-10 19:50:52 -0500
committerAndrew Chow <achow101-github@achow101.com>2020-03-08 12:27:05 -0400
commita4af324d15c1ee43c2abd11a304ae18c7ee82eb0 (patch)
tree594206fa804e9004ab10ba0085df99dea9763841 /src/wallet/wallet.cpp
parentf37de927442d3f024926a66c436d59e391c8696a (diff)
downloadbitcoin-a4af324d15c1ee43c2abd11a304ae18c7ee82eb0.tar.xz
Use CWallet::SignTransaction in CreateTransaction and signrawtransactionwithwallet
Instead of duplicating signing code, just use the function we already have.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index d25fba8bb6..a120354580 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2923,25 +2923,9 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
txNew.vin.push_back(CTxIn(coin.outpoint, CScript(), nSequence));
}
- if (sign)
- {
- int nIn = 0;
- for (const auto& coin : selected_coins)
- {
- const CScript& scriptPubKey = coin.txout.scriptPubKey;
- SignatureData sigdata;
-
- std::unique_ptr<SigningProvider> provider = GetSigningProvider(scriptPubKey);
- if (!provider || !ProduceSignature(*provider, MutableTransactionSignatureCreator(&txNew, nIn, coin.txout.nValue, SIGHASH_ALL), scriptPubKey, sigdata))
- {
- strFailReason = _("Signing transaction failed").translated;
- return false;
- } else {
- UpdateInput(txNew.vin.at(nIn), sigdata);
- }
-
- nIn++;
- }
+ if (sign && !SignTransaction(txNew)) {
+ strFailReason = _("Signing transaction failed").translated;
+ return false;
}
// Return the constructed transaction data.