From 501acb5538008d98abe79288b92040bc186b93f3 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Wed, 3 Jul 2019 16:58:28 -0400 Subject: Always try to sign for all pubkeys in multisig --- src/script/sign.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/script') diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 8791d1542a..58eae3ce96 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -144,8 +144,13 @@ static bool SignStep(const SigningProvider& provider, const BaseSignatureCreator ret.push_back(valtype()); // workaround CHECKMULTISIG bug for (size_t i = 1; i < vSolutions.size() - 1; ++i) { CPubKey pubkey = CPubKey(vSolutions[i]); - if (ret.size() < required + 1 && CreateSig(creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) { - ret.push_back(std::move(sig)); + // We need to always call CreateSig in order to fill sigdata with all + // possible signatures that we can create. This will allow further PSBT + // processing to work as it needs all possible signature and pubkey pairs + if (CreateSig(creator, sigdata, provider, sig, pubkey, scriptPubKey, sigversion)) { + if (ret.size() < required + 1) { + ret.push_back(std::move(sig)); + } } } bool ok = ret.size() == required + 1; -- cgit v1.2.3 From 4977c30d59e88a3e5ee248144bcc023debcd895b Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 30 Dec 2019 14:05:27 -0500 Subject: refactor: define a UINT256_ONE global constant Instead of having a uint256 representations of one scattered throughout where it is used, define it globally in uint256.h --- src/script/interpreter.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/script') diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index b919046ab6..d0865d2793 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1281,13 +1281,11 @@ uint256 SignatureHash(const CScript& scriptCode, const T& txTo, unsigned int nIn return ss.GetHash(); } - static const uint256 one(uint256S("0000000000000000000000000000000000000000000000000000000000000001")); - // Check for invalid use of SIGHASH_SINGLE if ((nHashType & 0x1f) == SIGHASH_SINGLE) { if (nIn >= txTo.vout.size()) { // nOut out of range - return one; + return UINT256_ONE(); } } -- cgit v1.2.3