psbt: add test vector where non-witness UTXO TXID does not match input txid

This commit is contained in:
Andrew Poelstra 2025-06-23 20:04:54 +00:00
parent 74f22a0a67
commit 53b93321c8
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 22 additions and 0 deletions

View File

@ -2113,6 +2113,28 @@ mod tests {
}
}
#[test]
fn invalid_vector_4617() {
let err = hex_psbt("70736274ff01007374ff0103010000000000000000002e2873007374ff0107736205000000000000000000000000000000000006060005feffffff74ff01000a000000000000002cc760008530b38dac0100030500000074ff01070100000000000000000000000000c0316888e006000600050000736274ff00d90001007374ff41030100000000000a0a06002e2873007374ff01070100000000000000000000000000000000ff0000060600050000736274ff01000a0080000000000024c7600005193b1e400700030500000074ff0107010000000000a9c7df3f07000570ed62c76004c3ca95c5f90200010742420a0a000000000000").unwrap_err();
match err {
Error::IncorrectNonWitnessUtxo { index: 0, input_outpoint, non_witness_utxo_txid } => {
assert_eq!(
input_outpoint,
"00000000000000000000000562730701ff74730073282e000000000000000000:0"
.parse()
.unwrap(),
);
assert_eq!(
non_witness_utxo_txid,
"9ed45fd3f73b038649bee6e763dbd70868745c48a0d2b0299f42c68f957995f4"
.parse()
.unwrap(),
);
}
_ => panic!("expected output hash mismatch error, got {}", err),
}
}
#[test]
fn serialize_and_deserialize_preimage_psbt() {
// create a sha preimage map