mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-06 03:36:18 +00:00
fuzz: make sure PSBT serialization roundtrips
This will prevent us from creating a serialization we do not accept going forward.
This commit is contained in:
parent
e09b81638b
commit
d76ec4de14
@ -33,6 +33,17 @@ FUZZ_TARGET(psbt)
|
||||
}
|
||||
const PartiallySignedTransaction psbt = psbt_mut;
|
||||
|
||||
// A PSBT must roundtrip.
|
||||
PartiallySignedTransaction psbt_roundtrip;
|
||||
std::vector<uint8_t> psbt_ser;
|
||||
VectorWriter{psbt_ser, 0, psbt};
|
||||
SpanReader{psbt_ser} >> psbt_roundtrip;
|
||||
|
||||
// And be stable across roundtrips.
|
||||
std::vector<uint8_t> roundtrip_ser;
|
||||
VectorWriter{roundtrip_ser, 0, psbt_roundtrip};
|
||||
Assert(psbt_ser == roundtrip_ser);
|
||||
|
||||
const PSBTAnalysis analysis = AnalyzePSBT(psbt);
|
||||
(void)PSBTRoleName(analysis.next);
|
||||
for (const PSBTInputAnalysis& input_analysis : analysis.inputs) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user