@@ -909,10 +909,21 @@ fn do_test_balances_on_local_commitment_htlcs(anchors: bool) {
909909 // Aggregated HTLC timeouts.
910910 assert_eq ! ( timeout_htlc_txn. len( ) , 1 ) ;
911911 check_spends ! ( timeout_htlc_txn[ 0 ] , commitment_tx, coinbase_tx) ;
912+ // One input from the commitment transaction for each HTLC, and one input to provide fees.
913+ assert_eq ! ( timeout_htlc_txn[ 0 ] . input. len( ) , 3 ) ;
914+ // HTLC timeout witnesses for anchor channels contain 284 bytes. Note that DER-encoded ECDSA
915+ // signatures vary in size.
916+ // https://github.com/lightning/bolts/blob/master/03-transactions.md#expected-weight-of-htlc-timeout-and-htlc-success-transactions
917+ assert_eq ! ( timeout_htlc_txn[ 0 ] . input[ 0 ] . witness. size( ) , 284 ) ;
918+ assert_eq ! ( timeout_htlc_txn[ 0 ] . input[ 1 ] . witness. size( ) , 284 ) ;
912919 } else {
913920 assert_eq ! ( timeout_htlc_txn. len( ) , 2 ) ;
914- check_spends ! ( timeout_htlc_txn[ 0 ] , commitment_tx, coinbase_tx) ;
915- check_spends ! ( timeout_htlc_txn[ 1 ] , commitment_tx, coinbase_tx) ;
921+ check_spends ! ( timeout_htlc_txn[ 0 ] , commitment_tx) ;
922+ check_spends ! ( timeout_htlc_txn[ 1 ] , commitment_tx) ;
923+ // HTLC timeout witnesses for non-anchor channels contain 281 bytes. Note that DER-encoded
924+ // ECDSA signatures vary in size.
925+ assert_eq ! ( timeout_htlc_txn[ 0 ] . input[ 0 ] . witness. size( ) , 281 ) ;
926+ assert_eq ! ( timeout_htlc_txn[ 1 ] . input[ 0 ] . witness. size( ) , 281 ) ;
916927 }
917928
918929 // Now confirm nodes[1]'s HTLC claim, giving nodes[0] the preimage. Note that the "maybe
@@ -931,6 +942,13 @@ fn do_test_balances_on_local_commitment_htlcs(anchors: bool) {
931942 // aggregated package.
932943 handle_bump_htlc_event ( & nodes[ 0 ] , 1 ) ;
933944 timeout_htlc_txn = nodes[ 0 ] . tx_broadcaster . unique_txn_broadcast ( ) ;
945+ assert_eq ! ( timeout_htlc_txn. len( ) , 1 ) ;
946+ check_spends ! ( timeout_htlc_txn[ 0 ] , commitment_tx, coinbase_tx) ;
947+ // One input from the commitment transaction for the HTLC, and one input to provide fees.
948+ assert_eq ! ( timeout_htlc_txn[ 0 ] . input. len( ) , 2 ) ;
949+ // HTLC timeout witnesses for anchor channels contain 284 bytes. Note that DER-encoded ECDSA
950+ // signatures vary in size.
951+ assert_eq ! ( timeout_htlc_txn[ 0 ] . input[ 0 ] . witness. size( ) , 284 ) ;
934952 }
935953
936954 // Now confirm nodes[0]'s HTLC-Timeout transaction, which changes the claimable balance to an
0 commit comments