@@ -3490,6 +3490,29 @@ static void update_view_from_inflights(struct peer *peer)
3490
3490
}
3491
3491
}
3492
3492
3493
+ static size_t count_inputs_with_exclusions (struct wally_psbt * psbt ,
3494
+ enum tx_role role_to_ignore ,
3495
+ u32 input_index_to_ignore )
3496
+ {
3497
+ size_t result = 0 ;
3498
+ for (size_t i = 0 ; i < psbt -> num_inputs ; i ++ ) {
3499
+ struct wally_psbt_input * in = & psbt -> inputs [i ];
3500
+ u64 in_serial ;
3501
+
3502
+ if (!psbt_get_serial_id (& in -> unknowns , & in_serial ))
3503
+ status_broken ("PSBT input %zu missing serial_id"
3504
+ " %s" , i , fmt_wally_psbt (tmpctx , psbt ));
3505
+ if (in_serial % 2 == role_to_ignore )
3506
+ continue ;
3507
+
3508
+ if (i == input_index_to_ignore )
3509
+ continue ;
3510
+
3511
+ result ++ ;
3512
+ }
3513
+ return result ;
3514
+ }
3515
+
3493
3516
/* Called to finish an ongoing splice OR on restart from channel_reestablish. */
3494
3517
static void resume_splice_negotiation (struct peer * peer ,
3495
3518
bool send_commitments ,
@@ -3520,7 +3543,6 @@ static void resume_splice_negotiation(struct peer *peer,
3520
3543
const u8 * msg_received ;
3521
3544
struct witness * * inws ;
3522
3545
struct bitcoin_signature * their_sig ;
3523
- size_t remote_inputs_needing_sigs ;
3524
3546
3525
3547
if (peer -> splicing ) {
3526
3548
inws = peer -> splicing -> inws ;
@@ -3767,28 +3789,6 @@ static void resume_splice_negotiation(struct peer *peer,
3767
3789
" received" ,
3768
3790
tal_count (inws ) - current_psbt -> num_inputs );
3769
3791
3770
- remote_inputs_needing_sigs = 0 ;
3771
- for (size_t i = 0 ; i < current_psbt -> num_inputs ; i ++ ) {
3772
- struct wally_psbt_input * in =
3773
- & current_psbt -> inputs [i ];
3774
- u64 in_serial ;
3775
-
3776
- if (!psbt_get_serial_id (& in -> unknowns , & in_serial )) {
3777
- status_broken ("PSBT input %zu missing serial_id"
3778
- " %s" , i ,
3779
- fmt_wally_psbt (tmpctx ,
3780
- current_psbt ));
3781
- return ;
3782
- }
3783
- if (in_serial % 2 == our_role )
3784
- continue ;
3785
-
3786
- if (i == splice_funding_index )
3787
- continue ;
3788
-
3789
- remote_inputs_needing_sigs ++ ;
3790
- }
3791
-
3792
3792
/* We put the PSBT + sigs all together */
3793
3793
for (size_t j = 0 , i = 0 ; i < current_psbt -> num_inputs ; i ++ ) {
3794
3794
struct wally_psbt_input * in =
@@ -3817,7 +3817,9 @@ static void resume_splice_negotiation(struct peer *peer,
3817
3817
" remote inputs needing sigs"
3818
3818
" and you sent %zu witness"
3819
3819
" bundles." ,
3820
- remote_inputs_needing_sigs ,
3820
+ count_inputs_with_exclusions (current_psbt ,
3821
+ our_role ,
3822
+ splice_funding_index ),
3821
3823
tal_count (inws ));
3822
3824
}
3823
3825
0 commit comments