From b425466d3470ca52440eb65f8021d2edcc3be889 Mon Sep 17 00:00:00 2001 From: random-zebra Date: Fri, 2 Oct 2020 00:57:52 +0200 Subject: [PATCH] [Script] Add fColdStaking bool to IsSolvable --- src/script/sign.cpp | 4 ++-- src/script/sign.h | 2 +- src/wallet/wallet.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/script/sign.cpp b/src/script/sign.cpp index fd09c3587e5d5..20ee7d81b38c9 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -381,14 +381,14 @@ bool DummySignatureCreator::CreateSig(std::vector& vchSig, const return true; } -bool IsSolvable(const CKeyStore& store, const CScript& script) +bool IsSolvable(const CKeyStore& store, const CScript& script, bool fColdStaking) { // This check is to make sure that the script we created can actually be solved for and signed by us // if we were to have the private keys. This is just to make sure that the script is valid and that, // if found in a transaction, we would still accept and relay that transaction. In particular, DummySignatureCreator creator(&store); SignatureData sigs; - if (ProduceSignature(creator, script, sigs, false)) { + if (ProduceSignature(creator, script, sigs, fColdStaking)) { // VerifyScript check is just defensive, and should never fail. assert(VerifyScript(sigs.scriptSig, script, STANDARD_SCRIPT_VERIFY_FLAGS, creator.Checker())); return true; diff --git a/src/script/sign.h b/src/script/sign.h index f3881274ce0c2..b49af499739a3 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -85,6 +85,6 @@ void UpdateTransaction(CMutableTransaction& tx, unsigned int nIn, const Signatur * have all private keys. While this function does not need private keys, the passed * keystore is used to look up public keys and redeemscripts by hash. * Solvability is unrelated to whether we consider this output to be ours. */ -bool IsSolvable(const CKeyStore& store, const CScript& script); +bool IsSolvable(const CKeyStore& store, const CScript& script, bool fColdStaking); #endif // BITCOIN_SCRIPT_SIGN_H diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d763631f8982b..9e9c41bd715df 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2065,7 +2065,7 @@ bool CWallet::AvailableCoins(std::vector* pCoins, // --> populates // skip delegated coins if (mine == ISMINE_SPENDABLE_DELEGATED && !fIncludeDelegated) continue; - bool solvable = IsSolvable(*this, pcoin->vout[i].scriptPubKey); + bool solvable = IsSolvable(*this, pcoin->vout[i].scriptPubKey, mine == ISMINE_COLD); bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable)) ||