Changeset View
Changeset View
Standalone View
Standalone View
src/test/sighashtype_tests.cpp
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | for (BaseSigHashType baseType : baseTypes) { | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(sighash_serialization_test) { | BOOST_AUTO_TEST_CASE(sighash_serialization_test) { | ||||
std::set<uint32_t> forkValues{0, 1, 0xab1fe9, 0xc81eea, 0xffffff}; | std::set<uint32_t> forkValues{0, 1, 0xab1fe9, 0xc81eea, 0xffffff}; | ||||
// Test all possible sig hash values embeded in signatures. | // Test all possible sig hash values embedded in signatures. | ||||
for (uint32_t sigHashType = 0x00; sigHashType <= 0xff; sigHashType++) { | for (uint32_t sigHashType = 0x00; sigHashType <= 0xff; sigHashType++) { | ||||
for (uint32_t forkValue : forkValues) { | for (uint32_t forkValue : forkValues) { | ||||
uint32_t rawType = sigHashType | (forkValue << 8); | uint32_t rawType = sigHashType | (forkValue << 8); | ||||
uint32_t baseType = rawType & 0x1f; | uint32_t baseType = rawType & 0x1f; | ||||
bool hasForkId = (rawType & SIGHASH_FORKID) != 0; | bool hasForkId = (rawType & SIGHASH_FORKID) != 0; | ||||
bool hasAnyoneCanPay = (rawType & SIGHASH_ANYONECANPAY) != 0; | bool hasAnyoneCanPay = (rawType & SIGHASH_ANYONECANPAY) != 0; | ||||
Show All 22 Lines |