@@ -26,7 +26,7 @@ use bdk::bitcoin::hash_types::{PubkeyHash, Txid};
2626use  bdk:: bitcoin:: hashes:: { hash160,  sha256d,  Hash } ; 
2727use  bdk:: bitcoin:: psbt:: { Input ,  PartiallySignedTransaction  as  PSBT } ; 
2828use  bdk:: bitcoin:: sighash:: EcdsaSighashType ; 
29- use  bdk:: bitcoin:: { Network ,   Sequence } ; 
29+ use  bdk:: bitcoin:: Sequence ; 
3030use  bdk:: database:: BatchDatabase ; 
3131use  bdk:: wallet:: tx_builder:: TxOrdering ; 
3232use  bdk:: wallet:: Wallet ; 
@@ -173,7 +173,7 @@ where
173173            . map ( |( utxo,  _) | ( utxo. outpoint ,  utxo. txout . clone ( ) ) ) 
174174            . collect ( ) ; 
175175
176-         verify_proof ( psbt,  message,  outpoints,   self . network ( ) ) 
176+         verify_proof ( psbt,  message,  outpoints) 
177177    } 
178178} 
179179
@@ -188,7 +188,6 @@ pub fn verify_proof(
188188    psbt :  & PSBT , 
189189    message :  & str , 
190190    outpoints :  Vec < ( OutPoint ,  TxOut ) > , 
191-     _network :  Network , 
192191)  -> Result < u64 ,  ProofError >  { 
193192    let  tx = psbt. clone ( ) . extract_tx ( ) ; 
194193
@@ -314,7 +313,7 @@ fn challenge_txin(message: &str) -> TxIn {
314313mod  test { 
315314    use  super :: * ; 
316315    use  bdk:: bitcoin:: secp256k1:: ecdsa:: { SerializedSignature ,  Signature } ; 
317-     use  bdk:: bitcoin:: { Network ,  Witness } ; 
316+     use  bdk:: bitcoin:: { Address ,   Network ,  Witness } ; 
318317    use  bdk:: wallet:: get_funded_wallet; 
319318    use  std:: str:: FromStr ; 
320319
@@ -406,7 +405,7 @@ mod test {
406405            . iter ( ) 
407406            . map ( |utxo| ( utxo. outpoint ,  utxo. txout . clone ( ) ) ) 
408407            . collect ( ) ; 
409-         let  spendable = verify_proof ( & psbt,  message,  outpoints,   Network :: Testnet ) . unwrap ( ) ; 
408+         let  spendable = verify_proof ( & psbt,  message,  outpoints) . unwrap ( ) ; 
410409
411410        assert_eq ! ( spendable,  50_000 ) ; 
412411    } 
@@ -498,6 +497,39 @@ mod test {
498497        wallet. verify_proof ( & psbt,  message,  None ) . unwrap ( ) ; 
499498    } 
500499
500+     #[ test]  
501+     fn  burner_output ( )  { 
502+         let  psbt = get_signed_proof ( ) ; 
503+ 
504+         let  pkh = PubkeyHash :: from_raw_hash ( hash160:: Hash :: hash ( & [ 0 ] ) ) ; 
505+         let  out_script_unspendable = ScriptBuf :: new_p2pkh ( & pkh) ; 
506+         assert_eq ! ( 
507+             psbt. unsigned_tx. output[ 0 ] . script_pubkey, 
508+             out_script_unspendable
509+         ) ; 
510+ 
511+         let  addr_unspendable = Address :: new ( 
512+             Network :: Bitcoin , 
513+             bdk:: bitcoin:: address:: Payload :: PubkeyHash ( pkh) , 
514+         ) ; 
515+         assert_eq ! ( 
516+             addr_unspendable. to_string( ) , 
517+             "1FYMZEHnszCHKTBdFZ2DLrUuk3dGwYKQxh" 
518+         ) ; 
519+         // https://mempool.space/de/address/1FYMZEHnszCHKTBdFZ2DLrUuk3dGwYKQxh 
520+         // https://bitcoin.stackexchange.com/questions/65969/invalid-public-key-was-spent-how-was-this-possible 
521+ 
522+         let  addr_unspendable_testnet = Address :: new ( 
523+             Network :: Testnet , 
524+             bdk:: bitcoin:: address:: Payload :: PubkeyHash ( pkh) , 
525+         ) ; 
526+         assert_eq ! ( 
527+             addr_unspendable_testnet. to_string( ) , 
528+             "mv4JrHNmh1dY6ZfEy7zbAmhEc3Dyr8ULqX" 
529+         ) ; 
530+         // this address can be discovered in the transaction in https://ulrichard.ch/blog/?p=2566 
531+     } 
532+ 
501533    #[ test]  
502534    #[ should_panic( expected = "InvalidOutput" ) ]  
503535    fn  invalid_output ( )  { 
0 commit comments