mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
test: fix P2SH output in coins cache fuzz
The `coinscache_sim` fuzz target builds a 23-byte P2SH scriptPubKey manually.
Place `OP_EQUAL` at index 22, after `OP_HASH160`, the 20-byte push opcode, and the 20-byte script hash.
This matches `CScript::IsPayToScriptHash()`, which checks byte 22 for `OP_EQUAL`, see src/script/script.cpp#L229
Github-Pull: #35218
Rebased-From: ac58e6c53c
This commit is contained in:
@@ -70,7 +70,7 @@ struct PrecomputedData
|
||||
coins[i].out.scriptPubKey[0] = OP_HASH160;
|
||||
coins[i].out.scriptPubKey[1] = 20;
|
||||
std::copy(hash.begin(), hash.begin() + 20, coins[i].out.scriptPubKey.begin() + 2);
|
||||
coins[i].out.scriptPubKey[12] = OP_EQUAL;
|
||||
coins[i].out.scriptPubKey[22] = OP_EQUAL;
|
||||
break;
|
||||
case 2: /* P2WPKH */
|
||||
coins[i].out.scriptPubKey.resize(22);
|
||||
@@ -451,7 +451,7 @@ FUZZ_TARGET(coinscache_sim)
|
||||
}
|
||||
}
|
||||
|
||||
// HaveCoinInCache ignores spent coins, so GetCacheSize() may exceed it. */
|
||||
// HaveCoinInCache ignores spent coins, so GetCacheSize() may exceed it.
|
||||
assert(cache.GetCacheSize() >= cache_size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user