mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-15 03:51:23 +01:00
itest: assert closing tx is set in waiting_close_channels
This commit is contained in:
parent
e794bd37a4
commit
b6616bc040
2 changed files with 22 additions and 2 deletions
|
@ -2,6 +2,7 @@ package itest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -141,7 +142,24 @@ func testCommitmentTransactionDeadline(ht *lntest.HarnessTest) {
|
||||||
// Now that the channel has been force closed, it should show
|
// Now that the channel has been force closed, it should show
|
||||||
// up in the PendingChannels RPC under the waiting close
|
// up in the PendingChannels RPC under the waiting close
|
||||||
// section.
|
// 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.
|
// We should see Alice's force closing tx in the mempool.
|
||||||
expectedNumTxes := 1
|
expectedNumTxes := 1
|
||||||
|
|
|
@ -131,7 +131,9 @@ func (h *HarnessRPC) PendingChannels() *lnrpc.PendingChannelsResponse {
|
||||||
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
|
ctxt, cancel := context.WithTimeout(h.runCtx, DefaultTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
pendingChansRequest := &lnrpc.PendingChannelsRequest{}
|
pendingChansRequest := &lnrpc.PendingChannelsRequest{
|
||||||
|
IncludeRawTx: true,
|
||||||
|
}
|
||||||
resp, err := h.LN.PendingChannels(ctxt, pendingChansRequest)
|
resp, err := h.LN.PendingChannels(ctxt, pendingChansRequest)
|
||||||
|
|
||||||
// TODO(yy): We may get a `unable to find arbitrator` error from the
|
// TODO(yy): We may get a `unable to find arbitrator` error from the
|
||||||
|
|
Loading…
Add table
Reference in a new issue