@@ -4867,13 +4867,16 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
48674867 } else if let Some ( per_commitment_claimable_data) = per_commitment_option {
48684868 assert_eq ! ( funding_spent. funding_txid( ) , funding_txid_spent) ;
48694869
4870- // While this isn't useful yet, there is a potential race where if a counterparty
4871- // revokes a state at the same time as the commitment transaction for that state is
4872- // confirmed, and the watchtower receives the block before the user, the user could
4873- // upload a new ChannelMonitor with the revocation secret but the watchtower has
4874- // already processed the block, resulting in the counterparty_commitment_txn_on_chain entry
4875- // not being generated by the above conditional. Thus, to be safe, we go ahead and
4876- // insert it here.
4870+ // Track that this counterparty commitment tx appeared on-chain. This is
4871+ // used by `provide_payment_preimage` to look up the commitment number
4872+ // when a preimage arrives after the commitment tx is already confirmed.
4873+ // It also handles a race where a counterparty revokes a state at the
4874+ // same time as the commitment transaction for that state is confirmed,
4875+ // and the watchtower receives the block before the user. The user could
4876+ // upload a new ChannelMonitor with the revocation secret but the
4877+ // watchtower has already processed the block, resulting in the
4878+ // counterparty_commitment_txn_on_chain entry not being generated by
4879+ // the above conditional.
48774880 self . counterparty_commitment_txn_on_chain . insert ( commitment_txid, commitment_number) ;
48784881
48794882 log_info ! ( logger, "Got broadcast of non-revoked counterparty commitment transaction {}" , commitment_txid) ;
0 commit comments