itest: assert closing tx is set in waiting_close_channels

This commit is contained in:
Jesse de Wit 2024-01-25 19:51:11 +01:00
parent e794bd37a4
commit b6616bc040
No known key found for this signature in database
GPG key ID: 78A9DCCE385AE6B4
2 changed files with 22 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package itest
import (
"bytes"
"encoding/hex"
"fmt"
"testing"
@ -141,7 +142,24 @@ func testCommitmentTransactionDeadline(ht *lntest.HarnessTest) {
// Now that the channel has been force closed, it should show
// up in the PendingChannels RPC under the waiting close
// section.
ht.AssertChannelWaitingClose(alice, chanPoint)
waitingClose := ht.AssertChannelWaitingClose(alice, chanPoint)
// The waiting close channel closing tx hex should be set and
// be valid.
require.NotEmpty(ht, waitingClose.ClosingTxHex)
rawTxBytes, err := hex.DecodeString(waitingClose.ClosingTxHex)
require.NoError(
ht, err,
"waiting close channel closingTxHex invalid hex",
)
rawTx := &wire.MsgTx{}
err = rawTx.Deserialize(bytes.NewReader(rawTxBytes))
require.NoError(
ht, err, "waiting close channel ClosingTxHex invalid",
)
require.Equal(
ht, waitingClose.ClosingTxid, rawTx.TxHash().String(),
)
// We should see Alice's force closing tx in the mempool.
expectedNumTxes := 1

View file

@ -131,7 +131,9 @@ func (h *HarnessRPC) PendingChannels() *lnrpc.PendingChannelsResponse {
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
defer cancel()
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
pendingChansRequest := &lnrpc.PendingChannelsRequest{
IncludeRawTx: true,
}
resp, err := h.LN.PendingChannels(ctxt, pendingChansRequest)
// TODO(yy): We may get a `unable to find arbitrator` error from the