Changeset View
Changeset View
Standalone View
Standalone View
src/script/interpreter.cpp
Show First 20 Lines • Show All 1,343 Lines • ▼ Show 20 Lines | PrecomputedTransactionData::PrecomputedTransactionData( | ||||
hashSequence = GetSequenceHash(txTo); | hashSequence = GetSequenceHash(txTo); | ||||
hashOutputs = GetOutputsHash(txTo); | hashOutputs = GetOutputsHash(txTo); | ||||
} | } | ||||
uint256 SignatureHash(const CScript &scriptCode, const CTransaction &txTo, | uint256 SignatureHash(const CScript &scriptCode, const CTransaction &txTo, | ||||
unsigned int nIn, SigHashType sigHashType, | unsigned int nIn, SigHashType sigHashType, | ||||
const Amount amount, | const Amount amount, | ||||
const PrecomputedTransactionData *cache, uint32_t flags) { | const PrecomputedTransactionData *cache, uint32_t flags) { | ||||
if (flags & SCRIPT_ENABLE_REPLAY_PROTECTION) { | |||||
// Legacy chain's value for fork id must start with 0xff. | |||||
// By xoring with 0xdead, we ensure that the value will be different | |||||
// from the original one, even if it starts with 0xff. | |||||
uint32_t oldForkValue = sigHashType.getForkValue(); | |||||
sigHashType = sigHashType.withForkValue(0xff | (oldForkValue ^ 0xdead)); | |||||
} | |||||
if (sigHashType.hasForkId() && (flags & SCRIPT_ENABLE_SIGHASH_FORKID)) { | if (sigHashType.hasForkId() && (flags & SCRIPT_ENABLE_SIGHASH_FORKID)) { | ||||
uint256 hashPrevouts; | uint256 hashPrevouts; | ||||
uint256 hashSequence; | uint256 hashSequence; | ||||
uint256 hashOutputs; | uint256 hashOutputs; | ||||
if (!sigHashType.hasAnyoneCanPay()) { | if (!sigHashType.hasAnyoneCanPay()) { | ||||
hashPrevouts = cache ? cache->hashPrevouts : GetPrevoutHash(txTo); | hashPrevouts = cache ? cache->hashPrevouts : GetPrevoutHash(txTo); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |