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:
1 parent
e09b81638b
commit
d76ec4de14
1 file changed
+11
@@ -33,6 +33,17 @@ FUZZ_TARGET(psbt)
|
|||||||
}
|
}
|
||||||
const PartiallySignedTransaction psbt = psbt_mut;
|
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);
|
const PSBTAnalysis analysis = AnalyzePSBT(psbt);
|
||||||
(void)PSBTRoleName(analysis.next);
|
(void)PSBTRoleName(analysis.next);
|
||||||
for (const PSBTInputAnalysis& input_analysis : analysis.inputs) {
|
for (const PSBTInputAnalysis& input_analysis : analysis.inputs) {
|
||||||
|
|||||||
Reference in new issue
Block a user