diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1028,13 +1028,13 @@ } bool fSuccess = true; - size_t ikey = idxTopKey; - size_t isig = idxTopSig; int nSigsRemaining = nSigsCount; int nKeysRemaining = nKeysCount; while (fSuccess && nSigsRemaining > 0) { - valtype &vchSig = stacktop(-isig); - valtype &vchPubKey = stacktop(-ikey); + valtype &vchSig = stacktop( + -idxTopSig - (nSigsCount - nSigsRemaining)); + valtype &vchPubKey = stacktop( + -idxTopKey - (nKeysCount - nKeysRemaining)); // Note how this makes the exact order of // pubkey/signature evaluation distinguishable by @@ -1053,10 +1053,8 @@ scriptCode, flags); if (fOk) { - isig++; nSigsRemaining--; } - ikey++; nKeysRemaining--; // If there are more signatures left than keys left,