Changeset View
Changeset View
Standalone View
Standalone View
src/test/sigencoding_tests.cpp
Show All 25 Lines | static void CheckSignatureEncodingWithSigHashType(const valtype &vchSig, | ||||
const bool hasForkId = (flags & SCRIPT_ENABLE_SIGHASH_FORKID) != 0; | const bool hasForkId = (flags & SCRIPT_ENABLE_SIGHASH_FORKID) != 0; | ||||
const bool hasStrictEnc = (flags & SCRIPT_VERIFY_STRICTENC) != 0; | const bool hasStrictEnc = (flags & SCRIPT_VERIFY_STRICTENC) != 0; | ||||
const bool is64 = (vchSig.size() == 64); | const bool is64 = (vchSig.size() == 64); | ||||
std::vector<BaseSigHashType> allBaseTypes{ | std::vector<BaseSigHashType> allBaseTypes{ | ||||
BaseSigHashType::ALL, BaseSigHashType::NONE, BaseSigHashType::SINGLE}; | BaseSigHashType::ALL, BaseSigHashType::NONE, BaseSigHashType::SINGLE}; | ||||
std::vector<SigHashType> baseSigHashes; | std::vector<SigHashType> baseSigHashes; | ||||
for (const BaseSigHashType baseType : allBaseTypes) { | for (const BaseSigHashType &baseType : allBaseTypes) { | ||||
const SigHashType baseSigHash = SigHashType().withBaseType(baseType); | const SigHashType baseSigHash = SigHashType().withBaseType(baseType); | ||||
baseSigHashes.push_back(baseSigHash); | baseSigHashes.push_back(baseSigHash); | ||||
baseSigHashes.push_back(baseSigHash.withAnyoneCanPay(true)); | baseSigHashes.push_back(baseSigHash.withAnyoneCanPay(true)); | ||||
} | } | ||||
for (const SigHashType baseSigHash : baseSigHashes) { | for (const SigHashType baseSigHash : baseSigHashes) { | ||||
// Check the signature with the proper forkid flag. | // Check the signature with the proper forkid flag. | ||||
SigHashType sigHash = baseSigHash.withForkId(hasForkId); | SigHashType sigHash = baseSigHash.withForkId(hasForkId); | ||||
▲ Show 20 Lines • Show All 409 Lines • Show Last 20 Lines |