You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge rust-bitcoin#5402: primitives: reject transaction with duplicate inputs
af7a11b primitives: reject transaction with duplicate inputs (jrakibi)
Pull request description:
As part of adding validation rules to transactions, this check rejects transactions with duplicate inputs during the decoding stage
Also updated a test case in the encode/decode roundtrip, the test was using duplicated inputs which causes it to fail with the current implementation.
Addresses part of rust-bitcoin#5383
Related: CVE-2018-17144
ACKs for top commit:
apoelstra:
ACK af7a11b; successfully ran local tests
tcharding:
ACK af7a11b
Tree-SHA512: d1d071973b855ee83af42c42c23bbda2207d8a6dda1f90208ce25d98f144ba7ce927e9dc1073ce57187e89aa7d37ac0b5eb1fe75962d3e15dd29c562ad2638be
// Transaction has two inputs both spending the same outpoint
2485
+
let tx_bytes = hex!("01000000020001000000000000000000000000000000000000000000000000000000000000000000006c47304402204bb1197053d0d7799bf1b30cd503c44b58d6240cccbdc85b6fe76d087980208f02204beeed78200178ffc6c74237bb74b3f276bbb4098b5605d814304fe128bf1431012321039e8815e15952a7c3fada1905f8cf55419837133bd7756c0ef14fc8dfe50c0deaacffffffff0001000000000000000000000000000000000000000000000000000000000000000000006c47304402202306489afef52a6f62e90bf750bbcdf40c06f5c6b138286e6b6b86176bb9341802200dba98486ea68380f47ebb19a7df173b99e6bc9c681d6ccf3bde31465d1f16b3012321039e8815e15952a7c3fada1905f8cf55419837133bd7756c0ef14fc8dfe50c0deaacffffffff010000000000000000015100000000");
2486
+
2487
+
letmut decoder = Transaction::decoder();
2488
+
letmut slice = tx_bytes.as_slice();
2489
+
decoder.push_bytes(&mut slice).unwrap();
2490
+
let err = decoder.end().expect_err("transaction with duplicate inputs should be rejected");
0 commit comments