Refactor script validation to observe amounts

This is a preparation for BIP143 support.

Edited for Zcash merge by Ariel Gabizon.
This commit is contained in:
Pieter Wuille
2016-03-31 14:51:29 +02:00
committed by Jack Grigg
parent ffda7e01a5
commit 2d42e1a993
14 changed files with 49 additions and 37 deletions

View File

@@ -17,7 +17,8 @@ using namespace std;
typedef vector<unsigned char> valtype;
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), checker(txTo, nIn) {}
static const CAmount amountZero = 0;
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), checker(txTo, nIn, amountZero) {}
bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode) const
{
@@ -263,7 +264,7 @@ static CScript CombineSignatures(const CScript& scriptPubKey, const BaseSignatur
CScript CombineSignatures(const CScript& scriptPubKey, const CTransaction& txTo, unsigned int nIn,
const CScript& scriptSig1, const CScript& scriptSig2)
{
TransactionSignatureChecker checker(&txTo, nIn);
TransactionSignatureChecker checker(&txTo, nIn, amountZero);
return CombineSignatures(scriptPubKey, checker, scriptSig1, scriptSig2);
}