Fix backporting errors
pos.cpp primitives/transaction.cpp rpc/rawtransaction.cpp script/sign.cpp script/sign.h txmempool.cpp
This commit is contained in:
@@ -179,7 +179,7 @@ bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsig
|
||||
if (txin.prevout.hash != txFrom.GetHash())
|
||||
return false;
|
||||
|
||||
return VerifyScript(txin.scriptSig, txout.scriptPubKey, flags, TransactionSignatureChecker(&txTo, nIn), NULL);
|
||||
return VerifyScript(txin.scriptSig, txout.scriptPubKey, flags, TransactionSignatureChecker(&txTo, nIn, 0), NULL);
|
||||
}
|
||||
|
||||
bool CheckKernel(CBlockIndex* pindexPrev, unsigned int nBits, uint32_t nTimeBlock, const COutPoint& prevout, uint32_t* pBlockTime){
|
||||
|
||||
@@ -57,7 +57,7 @@ uint256 CTxOut::GetHash() const
|
||||
|
||||
std::string CTxOut::ToString() const
|
||||
{
|
||||
if (IsEmpty()) return "CTxOut(empty)";
|
||||
if (IsEmpty()) return "CTxOut(empty)";
|
||||
return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, HexStr(scriptPubKey).substr(0, 30));
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ uint256 CMutableTransaction::GetHash() const
|
||||
|
||||
uint256 CMutableTransaction::GetNormalizedHash() const
|
||||
{
|
||||
return SignatureHash(CScript(), *this, 0, SIGHASH_ALL);
|
||||
return SignatureHash(CScript(), *this, 0, SIGHASH_ALL, 0);
|
||||
}
|
||||
|
||||
void CTransaction::UpdateHash() const
|
||||
|
||||
@@ -823,7 +823,7 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
||||
|
||||
// ... and merge in other signatures:
|
||||
BOOST_FOREACH(const CMutableTransaction& txv, txVariants) {
|
||||
txin.scriptSig = CombineSignatures(prevPubKey, txConst, i, amount, txin.scriptSig, txv.vin[i].scriptSig);
|
||||
txin.scriptSig = CombineSignatures(prevPubKey, TransactionSignatureChecker(&txConst, i, amount), txin.scriptSig, txv.vin[i].scriptSig);
|
||||
}
|
||||
ScriptError serror = SCRIPT_ERR_OK;
|
||||
if (!VerifyScript(txin.scriptSig, prevPubKey, STANDARD_SCRIPT_VERIFY_FLAGS, TransactionSignatureChecker(&txConst, i, amount), &serror)) {
|
||||
|
||||
@@ -18,8 +18,7 @@ using namespace std;
|
||||
|
||||
typedef std::vector<unsigned char> valtype;
|
||||
|
||||
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) {}
|
||||
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
||||
|
||||
bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& address, const CScript& scriptCode) const
|
||||
{
|
||||
@@ -27,7 +26,7 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
||||
if (!keystore->GetKey(address, key))
|
||||
return false;
|
||||
|
||||
uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType);
|
||||
uint256 hash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount);
|
||||
if (!key.Sign(hash, vchSig))
|
||||
return false;
|
||||
vchSig.push_back((unsigned char)nHashType);
|
||||
@@ -259,7 +258,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, amountZero);
|
||||
TransactionSignatureChecker checker(&txTo, nIn, 0);
|
||||
return CombineSignatures(scriptPubKey, checker, scriptSig1, scriptSig2);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,11 @@ class TransactionSignatureCreator : public BaseSignatureCreator {
|
||||
const CTransaction* txTo;
|
||||
unsigned int nIn;
|
||||
int nHashType;
|
||||
CAmount amount;
|
||||
const TransactionSignatureChecker checker;
|
||||
|
||||
public:
|
||||
TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, int nHashTypeIn=SIGHASH_ALL);
|
||||
TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn=SIGHASH_ALL);
|
||||
const BaseSignatureChecker& Checker() const { return checker; }
|
||||
bool CreateSig(std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode) const;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "consensus/consensus.h"
|
||||
#include "consensus/validation.h"
|
||||
#include "main.h"
|
||||
#include "policy/policy.h"
|
||||
#include "policy/fees.h"
|
||||
#include "streams.h"
|
||||
#include "timedata.h"
|
||||
@@ -718,7 +719,8 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||
waitingOnDependants.push_back(&(*it));
|
||||
else {
|
||||
CValidationState state;
|
||||
assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, NULL));
|
||||
PrecomputedTransactionData txdata(tx);
|
||||
assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, txdata, NULL));
|
||||
UpdateCoins(tx, state, mempoolDuplicate, 1000000);
|
||||
}
|
||||
}
|
||||
@@ -732,7 +734,8 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
||||
stepsSinceLastRemove++;
|
||||
assert(stepsSinceLastRemove < waitingOnDependants.size());
|
||||
} else {
|
||||
assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, NULL));
|
||||
PrecomputedTransactionData txdata(entry->GetTx());
|
||||
assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, txdata, NULL));
|
||||
UpdateCoins(entry->GetTx(), state, mempoolDuplicate, 1000000);
|
||||
stepsSinceLastRemove = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user