@@ -7637,7 +7637,7 @@ mod tests {
7637
7637
}
7638
7638
7639
7639
macro_rules! check_dynamic_output_p2wpkh {
7640
- ( $node: expr) => {
7640
+ ( $node: expr, $expected : expr ) => {
7641
7641
{
7642
7642
let events = $node. chan_monitor. simple_monitor. get_and_clear_pending_events( ) ;
7643
7643
let mut txn = Vec :: new( ) ;
@@ -7673,7 +7673,7 @@ mod tests {
7673
7673
spend_tx. input[ 0 ] . witness. push( remotepubkey. serialize( ) . to_vec( ) ) ;
7674
7674
txn. push( spend_tx) ;
7675
7675
} ,
7676
- _ => panic!( "Unexpected event" ) ,
7676
+ _ => { if $expected == true { } else { panic!( "Unexpected event" ) } } ,
7677
7677
}
7678
7678
}
7679
7679
} ,
@@ -7786,12 +7786,39 @@ mod tests {
7786
7786
MessageSendEvent :: BroadcastChannelUpdate { .. } => { } ,
7787
7787
_ => panic ! ( "Unexpected event" ) ,
7788
7788
}
7789
- let spend_txn = check_dynamic_output_p2wpkh ! ( nodes[ 1 ] ) ;
7789
+ let spend_txn = check_dynamic_output_p2wpkh ! ( nodes[ 1 ] , false ) ;
7790
7790
assert_eq ! ( spend_txn. len( ) , 2 ) ;
7791
7791
assert_eq ! ( spend_txn[ 0 ] , spend_txn[ 1 ] ) ;
7792
7792
check_spends ! ( spend_txn[ 0 ] , node_txn[ 0 ] . clone( ) ) ;
7793
7793
}
7794
7794
7795
+ #[ test]
7796
+ fn test_claim_on_remote_revoked_sizeable_push_msat ( ) {
7797
+ // Same test as precedent, just test on remote revoked commitment tx, as per_commitment_point registration changes following you're funder/fundee and
7798
+ // to_remote output is encumbered by a P2WPKH
7799
+
7800
+ let nodes = create_network ( 2 ) ;
7801
+
7802
+ let chan = create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 100000 , 59000000 ) ;
7803
+ let payment_preimage = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 3000000 ) . 0 ;
7804
+ let revoked_local_txn = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) . by_id . get ( & chan. 2 ) . unwrap ( ) . last_local_commitment_txn . clone ( ) ;
7805
+ assert_eq ! ( revoked_local_txn[ 0 ] . input. len( ) , 1 ) ;
7806
+ assert_eq ! ( revoked_local_txn[ 0 ] . input[ 0 ] . previous_output. txid, chan. 3 . txid( ) ) ;
7807
+
7808
+ claim_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , payment_preimage) ;
7809
+ let header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
7810
+ nodes[ 1 ] . chain_monitor . block_connected_with_filtering ( & Block { header, txdata : vec ! [ revoked_local_txn[ 0 ] . clone( ) ] } , 1 ) ;
7811
+ let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
7812
+ match events[ 0 ] {
7813
+ MessageSendEvent :: BroadcastChannelUpdate { .. } => { } ,
7814
+ _ => panic ! ( "Unexpected event" ) ,
7815
+ }
7816
+ let spend_txn = check_dynamic_output_p2wpkh ! ( nodes[ 1 ] , true ) ;
7817
+ assert_eq ! ( spend_txn. len( ) , 2 ) ;
7818
+ assert_eq ! ( spend_txn[ 0 ] , spend_txn[ 1 ] ) ;
7819
+ check_spends ! ( spend_txn[ 0 ] , revoked_local_txn[ 0 ] . clone( ) ) ;
7820
+ }
7821
+
7795
7822
#[ test]
7796
7823
fn test_static_spendable_outputs_preimage_tx ( ) {
7797
7824
let nodes = create_network ( 2 ) ;
0 commit comments