mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 23:53:41 +02:00
itest: remove direct reference to stanby nodes
Prepares the upcoming refactor. We now never call `ht.Alice` directly, instead, we always init `alice := ht.Alice` so it's easier to see how they are removed in a following commit.
This commit is contained in:
@@ -13,6 +13,8 @@ import (
|
||||
// sets. For completeness, it also asserts that features aren't set in places
|
||||
// where they aren't intended to be.
|
||||
func testCustomFeatures(ht *lntest.HarnessTest) {
|
||||
alice, bob := ht.Alice, ht.Bob
|
||||
|
||||
var (
|
||||
// Odd custom features so that we don't need to worry about
|
||||
// issues connecting to peers.
|
||||
@@ -27,20 +29,20 @@ func testCustomFeatures(ht *lntest.HarnessTest) {
|
||||
fmt.Sprintf("--protocol.custom-nodeann=%v", customNodeAnn),
|
||||
fmt.Sprintf("--protocol.custom-invoice=%v", customInvoice),
|
||||
}
|
||||
ht.RestartNodeWithExtraArgs(ht.Alice, extraArgs)
|
||||
ht.RestartNodeWithExtraArgs(alice, extraArgs)
|
||||
|
||||
// Connect nodes and open a channel so that Alice will be included
|
||||
// in Bob's graph.
|
||||
ht.ConnectNodes(ht.Alice, ht.Bob)
|
||||
ht.ConnectNodes(alice, bob)
|
||||
chanPoint := ht.OpenChannel(
|
||||
ht.Alice, ht.Bob, lntest.OpenChannelParams{Amt: 1000000},
|
||||
alice, bob, lntest.OpenChannelParams{Amt: 1000000},
|
||||
)
|
||||
|
||||
// Check that Alice's custom feature bit was sent to Bob in her init
|
||||
// message.
|
||||
peers := ht.Bob.RPC.ListPeers()
|
||||
peers := bob.RPC.ListPeers()
|
||||
require.Len(ht, peers.Peers, 1)
|
||||
require.Equal(ht, peers.Peers[0].PubKey, ht.Alice.PubKeyStr)
|
||||
require.Equal(ht, peers.Peers[0].PubKey, alice.PubKeyStr)
|
||||
|
||||
_, customInitSet := peers.Peers[0].Features[customInit]
|
||||
require.True(ht, customInitSet)
|
||||
@@ -51,7 +53,7 @@ func testCustomFeatures(ht *lntest.HarnessTest) {
|
||||
|
||||
// Assert that Alice's custom feature bit is contained in the node
|
||||
// announcement sent to Bob.
|
||||
updates := ht.AssertNumNodeAnns(ht.Bob, ht.Alice.PubKeyStr, 1)
|
||||
updates := ht.AssertNumNodeAnns(bob, alice.PubKeyStr, 1)
|
||||
features := updates[len(updates)-1].Features
|
||||
_, customFeature := features[customNodeAnn]
|
||||
require.True(ht, customFeature)
|
||||
@@ -60,8 +62,8 @@ func testCustomFeatures(ht *lntest.HarnessTest) {
|
||||
)
|
||||
|
||||
// Assert that Alice's custom feature bit is included in invoices.
|
||||
invoice := ht.Alice.RPC.AddInvoice(&lnrpc.Invoice{})
|
||||
payReq := ht.Alice.RPC.DecodePayReq(invoice.PaymentRequest)
|
||||
invoice := alice.RPC.AddInvoice(&lnrpc.Invoice{})
|
||||
payReq := alice.RPC.DecodePayReq(invoice.PaymentRequest)
|
||||
_, customInvoiceSet := payReq.Features[customInvoice]
|
||||
require.True(ht, customInvoiceSet)
|
||||
assertFeatureNotInSet(
|
||||
@@ -79,9 +81,9 @@ func testCustomFeatures(ht *lntest.HarnessTest) {
|
||||
},
|
||||
},
|
||||
}
|
||||
ht.Alice.RPC.UpdateNodeAnnouncementErr(nodeAnnReq)
|
||||
alice.RPC.UpdateNodeAnnouncementErr(nodeAnnReq)
|
||||
|
||||
ht.CloseChannel(ht.Alice, chanPoint)
|
||||
ht.CloseChannel(alice, chanPoint)
|
||||
}
|
||||
|
||||
// assertFeatureNotInSet checks that the features provided aren't contained in
|
||||
|
Reference in New Issue
Block a user