Skip to content

Commit

Permalink
lnrpc: append listchannels command with the chan_id and short_chan_id
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Bansal <[email protected]>
  • Loading branch information
NishantBansal2003 committed Dec 27, 2024
1 parent a388c1f commit 6cf95f0
Show file tree
Hide file tree
Showing 13 changed files with 2,735 additions and 2,685 deletions.
4 changes: 2 additions & 2 deletions itest/lnd_estimate_route_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ func testEstimateRouteFee(ht *lntest.HarnessTest) {
PrivateOnly: true,
})
require.Len(ht, bobsPrivChannels.Channels, 1)
bobPaulaChanID := bobsPrivChannels.Channels[0].ChanId
bobPaulaChanID := bobsPrivChannels.Channels[0].ShortChanIdInt

evesPrivChannels := mts.eve.RPC.ListChannels(&lnrpc.ListChannelsRequest{
PrivateOnly: true,
})
require.Len(ht, evesPrivChannels.Channels, 1)
evePaulaChanID := evesPrivChannels.Channels[0].ChanId
evePaulaChanID := evesPrivChannels.Channels[0].ShortChanIdInt

// Let's disable the paths from Alice to Bob through Dave and Eve with
// high fees. This ensures that the path estimates are based on Carol's
Expand Down
4 changes: 2 additions & 2 deletions itest/lnd_funding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ func testChannelFundingPersistence(ht *lntest.HarnessTest) {

// Create an additional check for our channel assertion that will
// check that our label is as expected.
shortChanID := lnwire.NewShortChanIDFromInt(chanAlice.ChanId)
shortChanID := lnwire.NewShortChanIDFromInt(chanAlice.ShortChanIdInt)
label = labels.MakeLabel(labels.LabelTypeChannelOpen, &shortChanID)
require.Equal(ht, label, tx.Label, "open channel label not updated")
}
Expand Down Expand Up @@ -1177,7 +1177,7 @@ func ensurePolicy(ht *lntest.HarnessTest, alice, peer *node.HarnessNode,
channel := ht.AssertChannelExists(peer, chanPoint)
policy, err := peer.RPC.LN.GetChanInfo(
context.Background(), &lnrpc.ChanInfoRequest{
ChanId: channel.ChanId,
ChanId: channel.ShortChanIdInt,
},
)
require.NoError(ht, err)
Expand Down
2 changes: 1 addition & 1 deletion itest/lnd_htlc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func testLookupHtlcResolution(ht *lntest.HarnessTest) {

// Lookup the HTLC and assert the htlc is settled offchain.
req := &lnrpc.LookupHtlcResolutionRequest{
ChanId: channel.ChanId,
ChanId: channel.ShortChanIdInt,
HtlcIndex: 0,
}

Expand Down
2 changes: 1 addition & 1 deletion itest/lnd_htlc_timeout_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func makeRouteHints(bob, carol *node.HarnessNode,

hopHint := &lnrpc.HopHint{
NodeId: carolChan.RemotePubkey,
ChanId: carolChan.ChanId,
ChanId: carolChan.ShortChanIdInt,
FeeBaseMsat: uint32(
chainreg.DefaultBitcoinBaseFeeMSat,
),
Expand Down
2 changes: 1 addition & 1 deletion itest/lnd_misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ func testAbandonChannel(ht *lntest.HarnessTest) {

// Now that the channel is open, we'll obtain its channel ID real quick
// so we can use it to query the graph below.
chanID := ht.QueryChannelByChanPoint(alice, chanPoint).ChanId
chanID := ht.QueryChannelByChanPoint(alice, chanPoint).ShortChanIdInt

// To make sure the channel is removed from the backup file as well
// when being abandoned, grab a backup snapshot so we can compare it
Expand Down
6 changes: 3 additions & 3 deletions itest/lnd_route_blinding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func testQueryBlindedRoutes(ht *lntest.HarnessTest) {

// Sanity check that bob's fee is as expected.
chanInfoReq := &lnrpc.ChanInfoRequest{
ChanId: bobCarolChan.ChanId,
ChanId: bobCarolChan.ShortChanIdInt,
}

bobCarolInfo := bob.RPC.GetChanInfo(chanInfoReq)
Expand Down Expand Up @@ -200,14 +200,14 @@ func testQueryBlindedRoutes(ht *lntest.HarnessTest) {
TotalFeesMsat: int64(totalFee),
Hops: []*lnrpc.Hop{
{
ChanId: aliceBobChan.ChanId,
ChanId: aliceBobChan.ShortChanIdInt,
Expiry: hop0Expiry,
AmtToForwardMsat: hop0Amount,
FeeMsat: int64(bobCarolBase),
PubKey: bob.PubKeyStr,
},
{
ChanId: bobCarolChan.ChanId,
ChanId: bobCarolChan.ShortChanIdInt,
PubKey: carol.PubKeyStr,
BlindingPoint: blindingBytes,
FeeMsat: int64(blindedBaseFee),
Expand Down
13 changes: 7 additions & 6 deletions itest/lnd_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,8 @@ func testInvoiceRoutingHints(ht *lntest.HarnessTest) {

// We'll need the short channel ID of the channel between Alice and Bob
// to make sure the routing hint is for this channel.
aliceBobChanID := ht.QueryChannelByChanPoint(alice, chanPointBob).ChanId
aliceBobChanID := ht.QueryChannelByChanPoint(alice, chanPointBob).
ShortChanIdInt

checkInvoiceHints := func(invoice *lnrpc.Invoice) {
// Due to the way the channels were set up above, the channel
Expand Down Expand Up @@ -747,9 +748,9 @@ func testScidAliasRoutingHints(ht *lntest.HarnessTest) {
err := carol.RPC.XAddLocalChanAliasesErr(&routerrpc.AddAliasesRequest{
AliasMaps: []*lnrpc.AliasMap{
{
BaseScid: carolDaveChan.ChanId,
BaseScid: carolDaveChan.ShortChanIdInt,
Aliases: []uint64{
carolDaveChan.ChanId,
carolDaveChan.ShortChanIdInt,
},
},
},
Expand All @@ -765,7 +766,7 @@ func testScidAliasRoutingHints(ht *lntest.HarnessTest) {
ephemeralAlias := ephemeralChanPoint.ToUint64()
ephemeralAliasMap := []*lnrpc.AliasMap{
{
BaseScid: carolDaveChan.ChanId,
BaseScid: carolDaveChan.ShortChanIdInt,
Aliases: []uint64{
ephemeralAlias,
},
Expand Down Expand Up @@ -1383,12 +1384,12 @@ func testRouteFeeCutoff(ht *lntest.HarnessTest) {
// We'll also need the channel IDs for Bob's channels in order to
// confirm the route of the payments.
channel := ht.QueryChannelByChanPoint(bob, chanPointAliceBob)
aliceBobChanID := channel.ChanId
aliceBobChanID := channel.ShortChanIdInt
require.NotZero(ht, aliceBobChanID,
"channel between alice and bob not found")

channel = ht.QueryChannelByChanPoint(bob, chanPointBobDave)
bobDaveChanID := channel.ChanId
bobDaveChanID := channel.ShortChanIdInt
require.NotZero(ht, bobDaveChanID,
"channel between bob and dave not found")

Expand Down
Loading

0 comments on commit 6cf95f0

Please sign in to comment.