mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
server+funding: remove previous link update mechanism
Because we now send the correct initial forwarding policy to Brontide, the correct initial values are inserted into the link and we no longer need to update the link in a later step.
This commit is contained in:
committed by
yyforyongyu
parent
fb36806724
commit
d822d75f00
@@ -252,7 +252,6 @@ type testNode struct {
|
||||
testDir string
|
||||
shutdownChannel chan struct{}
|
||||
reportScidChan chan struct{}
|
||||
updatedPolicies chan map[wire.OutPoint]models.ForwardingPolicy
|
||||
localFeatures []lnwire.FeatureBit
|
||||
remoteFeatures []lnwire.FeatureBit
|
||||
|
||||
@@ -381,9 +380,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
||||
publTxChan := make(chan *wire.MsgTx, 1)
|
||||
shutdownChan := make(chan struct{})
|
||||
reportScidChan := make(chan struct{})
|
||||
updatedPolicies := make(
|
||||
chan map[wire.OutPoint]models.ForwardingPolicy, 1,
|
||||
)
|
||||
|
||||
wc := &mock.WalletController{
|
||||
RootKey: alicePrivKey,
|
||||
@@ -541,11 +537,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
||||
return nil, nil
|
||||
},
|
||||
AliasManager: aliasMgr,
|
||||
UpdateForwardingPolicies: func(
|
||||
p map[wire.OutPoint]models.ForwardingPolicy) {
|
||||
|
||||
updatedPolicies <- p
|
||||
},
|
||||
}
|
||||
|
||||
for _, op := range options {
|
||||
@@ -570,7 +561,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
||||
testDir: tempTestDir,
|
||||
shutdownChannel: shutdownChan,
|
||||
reportScidChan: reportScidChan,
|
||||
updatedPolicies: updatedPolicies,
|
||||
addr: addr,
|
||||
}
|
||||
|
||||
@@ -651,12 +641,11 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
|
||||
UpdateLabel: func(chainhash.Hash, string) error {
|
||||
return nil
|
||||
},
|
||||
ZombieSweeperInterval: oldCfg.ZombieSweeperInterval,
|
||||
ReservationTimeout: oldCfg.ReservationTimeout,
|
||||
OpenChannelPredicate: chainedAcceptor,
|
||||
DeleteAliasEdge: oldCfg.DeleteAliasEdge,
|
||||
AliasManager: oldCfg.AliasManager,
|
||||
UpdateForwardingPolicies: oldCfg.UpdateForwardingPolicies,
|
||||
ZombieSweeperInterval: oldCfg.ZombieSweeperInterval,
|
||||
ReservationTimeout: oldCfg.ReservationTimeout,
|
||||
OpenChannelPredicate: chainedAcceptor,
|
||||
DeleteAliasEdge: oldCfg.DeleteAliasEdge,
|
||||
AliasManager: oldCfg.AliasManager,
|
||||
})
|
||||
require.NoError(t, err, "failed recreating aliceFundingManager")
|
||||
|
||||
@@ -1145,21 +1134,6 @@ func assertChannelAnnouncements(t *testing.T, alice, bob *testNode,
|
||||
}
|
||||
}
|
||||
|
||||
// At this point we should also have gotten a policy update that
|
||||
// was sent to the switch subsystem. Make sure it contains the
|
||||
// same values.
|
||||
var policyUpdate models.ForwardingPolicy
|
||||
select {
|
||||
case policyUpdateMap := <-node.updatedPolicies:
|
||||
require.Len(t, policyUpdateMap, 1)
|
||||
for _, policy := range policyUpdateMap {
|
||||
policyUpdate = policy
|
||||
}
|
||||
|
||||
case <-time.After(time.Second * 5):
|
||||
t.Fatalf("node didn't send policy update")
|
||||
}
|
||||
|
||||
gotChannelAnnouncement := false
|
||||
gotChannelUpdate := false
|
||||
for _, msg := range announcements {
|
||||
@@ -1188,34 +1162,24 @@ func assertChannelAnnouncements(t *testing.T, alice, bob *testNode,
|
||||
minHtlc = customMinHtlc[j]
|
||||
}
|
||||
require.Equal(t, minHtlc, m.HtlcMinimumMsat)
|
||||
require.Equal(
|
||||
t, minHtlc, policyUpdate.MinHTLCOut,
|
||||
)
|
||||
|
||||
// We might expect a custom MaxHltc value.
|
||||
if len(customMaxHtlc) > 0 {
|
||||
maxHtlc = customMaxHtlc[j]
|
||||
}
|
||||
require.Equal(t, maxHtlc, m.HtlcMaximumMsat)
|
||||
require.Equal(t, maxHtlc, policyUpdate.MaxHTLC)
|
||||
|
||||
// We might expect a custom baseFee value.
|
||||
if len(baseFees) > 0 {
|
||||
baseFee = baseFees[j]
|
||||
}
|
||||
require.EqualValues(t, baseFee, m.BaseFee)
|
||||
require.EqualValues(
|
||||
t, baseFee, policyUpdate.BaseFee,
|
||||
)
|
||||
|
||||
// We might expect a custom feeRate value.
|
||||
if len(feeRates) > 0 {
|
||||
feeRate = feeRates[j]
|
||||
}
|
||||
require.EqualValues(t, feeRate, m.FeeRate)
|
||||
require.EqualValues(
|
||||
t, feeRate, policyUpdate.FeeRate,
|
||||
)
|
||||
|
||||
gotChannelUpdate = true
|
||||
}
|
||||
|
Reference in New Issue
Block a user