From 31d45757a456a9ff95e09e19f40a60dd86da99ec Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Thu, 27 Jun 2024 14:20:28 -0700 Subject: [PATCH] contractcourt: properly detect RBF coop close transactions This commit fixes an issue where we did not properly detect and therefore record the coop close transaction if it used the newer RBF coop close v2 scheme. This only affects coop closes of taproot channels today. --- contractcourt/chain_watcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contractcourt/chain_watcher.go b/contractcourt/chain_watcher.go index b17b40aca..f1733ad1f 100644 --- a/contractcourt/chain_watcher.go +++ b/contractcourt/chain_watcher.go @@ -12,6 +12,7 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/mempool" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" "github.com/davecgh/go-spew/spew" @@ -689,7 +690,10 @@ func (c *chainWatcher) closeObserver(spendNtfn *chainntnfs.SpendEvent) { // sequence number that's finalized. This won't happen with // regular commitment transactions due to the state hint // encoding scheme. - if commitTxBroadcast.TxIn[0].Sequence == wire.MaxTxInSequenceNum { + switch commitTxBroadcast.TxIn[0].Sequence { + case wire.MaxTxInSequenceNum: + fallthrough + case mempool.MaxRBFSequence: // TODO(roasbeef): rare but possible, need itest case // for err := c.dispatchCooperativeClose(commitSpend)