@@ -5038,23 +5038,32 @@ fn test_static_spendable_outputs_justice_tx_revoked_htlc_timeout_tx() {
5038
5038
5039
5039
let node_txn = nodes[ 1 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
5040
5040
assert_eq ! ( node_txn. len( ) , 4 ) ; // ChannelMonitor: justice tx on revoked commitment, justice tx on revoked HTLC-timeout, adjusted justice tx, ChannelManager: local commitment tx
5041
+ // The first transaction generated is bogus - it spends both outputs of revoked_local_txn[0]
5042
+ // including the one already spent by revoked_htlc_txn[0]. That's OK, we'll spend with valid
5043
+ // transactions next...
5041
5044
assert_eq ! ( node_txn[ 0 ] . input. len( ) , 2 ) ;
5042
5045
check_spends ! ( node_txn[ 0 ] , revoked_local_txn[ 0 ] ) ;
5046
+
5043
5047
check_spends ! ( node_txn[ 1 ] , chan_1. 3 ) ;
5048
+
5044
5049
assert_eq ! ( node_txn[ 2 ] . input. len( ) , 1 ) ;
5045
5050
check_spends ! ( node_txn[ 2 ] , revoked_htlc_txn[ 0 ] ) ;
5046
5051
assert_eq ! ( node_txn[ 3 ] . input. len( ) , 1 ) ;
5047
5052
check_spends ! ( node_txn[ 3 ] , revoked_local_txn[ 0 ] ) ;
5048
5053
5049
5054
let header_1 = BlockHeader { version : 0x20000000 , prev_blockhash : header. block_hash ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
5050
- nodes[ 1 ] . block_notifier . block_connected ( & Block { header : header_1, txdata : vec ! [ node_txn[ 0 ] . clone( ) , node_txn[ 2 ] . clone( ) ] } , 1 ) ;
5055
+ nodes[ 1 ] . block_notifier . block_connected ( & Block { header : header_1, txdata : vec ! [ node_txn[ 2 ] . clone( ) , node_txn[ 3 ] . clone( ) ] } , 1 ) ;
5051
5056
connect_blocks ( & nodes[ 1 ] . block_notifier , ANTI_REORG_DELAY - 1 , 1 , true , header. block_hash ( ) ) ;
5052
5057
5053
- // Check B's ChannelMonitor was able to generate the right spendable output descriptor
5058
+ // Note that nodes[1]'s tx_broadcaster is still locked, so if we get here the channelmonitor
5059
+ // didn't try to generate any new transactions.
5060
+
5061
+ // Check B's ChannelMonitor was able to generate the right spendable output descriptor which
5062
+ // allows the user to spend the newly-confirmed outputs.
5054
5063
let spend_txn = check_spendable_outputs ! ( nodes[ 1 ] , 1 , node_cfgs[ 1 ] . keys_manager, 100000 ) ;
5055
5064
assert_eq ! ( spend_txn. len( ) , 2 ) ;
5056
- check_spends ! ( spend_txn[ 0 ] , node_txn[ 0 ] ) ;
5057
- check_spends ! ( spend_txn[ 1 ] , node_txn[ 2 ] ) ;
5065
+ check_spends ! ( spend_txn[ 0 ] , node_txn[ 2 ] ) ;
5066
+ check_spends ! ( spend_txn[ 1 ] , node_txn[ 3 ] ) ;
5058
5067
}
5059
5068
5060
5069
#[ test]
0 commit comments