lntest+itest: extend CloseChannelAssertPending

In this commit, we extend `CloseChannelAssertPending` with new args that
returns the raw close status update (as we have more things we'd like to
assert), and also allows us to pass in a custom fee rate.
This commit is contained in:
Olaoluwa Osuntokun
2024-03-07 20:16:26 -08:00
parent 2899a757c4
commit fbc67f7610
4 changed files with 60 additions and 21 deletions

View File

@@ -5,6 +5,7 @@ import (
"time"
"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/fn/v2"
@@ -1963,8 +1964,8 @@ func testBumpForceCloseFee(ht *lntest.HarnessTest) {
ht.FundCoinsP2TR(btcutil.SatoshiPerBitcoin, alice)
// Alice force closes the channel which has no HTLCs at stake.
_, closingTxID := ht.CloseChannelAssertPending(alice, chanPoint, true)
require.NotNil(ht, closingTxID)
_, closeUpdates := ht.CloseChannelAssertPending(alice, chanPoint, true)
require.NotNil(ht, closeUpdates)
// Alice should see one waiting close channel.
ht.AssertNumWaitingClose(alice, 1)
@@ -1974,8 +1975,10 @@ func testBumpForceCloseFee(ht *lntest.HarnessTest) {
ht.AssertNumPendingSweeps(alice, 2)
// Calculate the commitment tx fee rate.
closingTx := ht.AssertTxInMempool(closingTxID)
require.NotNil(ht, closingTx)
pendingClose := closeUpdates.GetClosePending()
closeTxid, err := chainhash.NewHash(pendingClose.Txid)
require.NoError(ht, err)
closingTx := ht.AssertTxInMempool(*closeTxid)
// The default commitment fee for anchor channels is capped at 2500
// sat/kw but there might be some inaccuracies because of the witness