@@ -4130,7 +4130,7 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
4130
4130
1 => { None } ,
4131
4131
_ => return Err ( DecodeError :: InvalidValue ) ,
4132
4132
} ;
4133
- let counterparty_payment_script = Readable :: read ( reader) ?;
4133
+ let mut counterparty_payment_script: Script = Readable :: read ( reader) ?;
4134
4134
let shutdown_script = {
4135
4135
let script = <Script as Readable >:: read ( reader) ?;
4136
4136
if script. is_empty ( ) { None } else { Some ( script) }
@@ -4331,6 +4331,17 @@ impl<'a, 'b, ES: EntropySource, SP: SignerProvider> ReadableArgs<(&'a ES, &'b SP
4331
4331
( 17 , initial_counterparty_commitment_info, option) ,
4332
4332
} ) ;
4333
4333
4334
+ // Monitors for anchor outputs channels opened in v0.0.116 suffered from a bug in which the
4335
+ // wrong `counterparty_payment_script` was being tracked. Fix it now on deserialization to
4336
+ // give them a chance to recognize the spendable output.
4337
+ if onchain_tx_handler. channel_type_features ( ) . supports_anchors_zero_fee_htlc_tx ( ) &&
4338
+ counterparty_payment_script. is_v0_p2wpkh ( ) {
4339
+ let payment_point = onchain_tx_handler. channel_transaction_parameters
4340
+ . as_holder_broadcastable ( ) . broadcaster_pubkeys ( ) . payment_point ;
4341
+ counterparty_payment_script =
4342
+ chan_utils:: get_to_countersignatory_with_anchors_redeemscript ( & payment_point) ;
4343
+ }
4344
+
4334
4345
Ok ( ( best_block. block_hash ( ) , ChannelMonitor :: from_impl ( ChannelMonitorImpl {
4335
4346
latest_update_id,
4336
4347
commitment_transaction_number_obscure_factor,
0 commit comments