@@ -8138,7 +8138,7 @@ fn test_preimage_storage() {
81388138 create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) . 0 . contents . short_channel_id ;
81398139
81408140 {
8141- let ( payment_hash, payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 1008 , 42 ) ;
8141+ let ( payment_hash, payment_secret) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 7200 , 42 ) ;
81428142
81438143 let logger = test_utils:: TestLogger :: new ( ) ;
81448144 let net_graph_msg_handler = & nodes[ 0 ] . net_graph_msg_handler ;
@@ -8176,19 +8176,29 @@ fn test_secret_timeout() {
81768176
81778177 let ( payment_hash, payment_secret_1) = nodes[ 1 ] . node . create_inbound_payment ( Some ( 100_000 ) , 2 , 0 ) ;
81788178
8179- // We should fail to register the same payment hash twice, at least until we've connected two
8180- // blocks .
8179+ // We should fail to register the same payment hash twice, at least until we've connected a
8180+ // block with time 7200 + CHAN_CONFIRM_DEPTH + 1 .
81818181 if let Err ( APIError :: APIMisuseError { err } ) = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 , 0 ) {
81828182 assert_eq ! ( err, "Duplicate payment hash" ) ;
81838183 } else { panic ! ( ) ; }
8184- connect_blocks ( & nodes[ 1 ] , 1 ) ;
8184+ let mut block = Block {
8185+ header : BlockHeader {
8186+ version : 0x2000000 ,
8187+ prev_blockhash : nodes[ 1 ] . blocks . borrow ( ) . last ( ) . unwrap ( ) . 0 . block_hash ( ) ,
8188+ merkle_root : Default :: default ( ) ,
8189+ time : nodes[ 1 ] . blocks . borrow ( ) . len ( ) as u32 + 7200 , bits : 42 , nonce : 42 } ,
8190+ txdata : vec ! [ ] ,
8191+ } ;
8192+ connect_block ( & nodes[ 1 ] , & block) ;
81858193 if let Err ( APIError :: APIMisuseError { err } ) = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 , 0 ) {
81868194 assert_eq ! ( err, "Duplicate payment hash" ) ;
81878195 } else { panic ! ( ) ; }
81888196
81898197 // If we then connect the second block, we should be able to register the same payment hash
81908198 // again with a different user_payment_id (this time getting a new payment secret).
8191- connect_blocks ( & nodes[ 1 ] , 1 ) ;
8199+ block. header . prev_blockhash = block. header . block_hash ( ) ;
8200+ block. header . time += 1 ;
8201+ connect_block ( & nodes[ 1 ] , & block) ;
81928202 let our_payment_secret = nodes[ 1 ] . node . create_inbound_payment_for_hash ( payment_hash, Some ( 100_000 ) , 2 , 42 ) . unwrap ( ) ;
81938203 assert_ne ! ( payment_secret_1, our_payment_secret) ;
81948204
0 commit comments