mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-07 03:32:37 +02:00
Merge pull request #3197 from breez/optimize_prune_zombie_channels
Optimize prune zombie channels
This commit is contained in:
@@ -316,6 +316,7 @@ type testChannelPolicy struct {
|
||||
FeeRate lnwire.MilliSatoshi
|
||||
LastUpdate time.Time
|
||||
Disabled bool
|
||||
Direction bool
|
||||
}
|
||||
|
||||
type testChannelEnd struct {
|
||||
@@ -348,6 +349,9 @@ func symmetricTestChannel(alias1 string, alias2 string, capacity btcutil.Amount,
|
||||
id = chanID[0]
|
||||
}
|
||||
|
||||
node2Policy := *policy
|
||||
node2Policy.Direction = !policy.Direction
|
||||
|
||||
return &testChannel{
|
||||
Capacity: capacity,
|
||||
Node1: &testChannelEnd{
|
||||
@@ -356,7 +360,7 @@ func symmetricTestChannel(alias1 string, alias2 string, capacity btcutil.Amount,
|
||||
},
|
||||
Node2: &testChannelEnd{
|
||||
Alias: alias2,
|
||||
testChannelPolicy: policy,
|
||||
testChannelPolicy: &node2Policy,
|
||||
},
|
||||
ChannelID: id,
|
||||
}
|
||||
@@ -529,6 +533,9 @@ func createTestGraphFromChannels(testChannels []*testChannel, source string) (
|
||||
if testChannel.Node1.Disabled {
|
||||
channelFlags |= lnwire.ChanUpdateDisabled
|
||||
}
|
||||
if testChannel.Node1.Direction {
|
||||
channelFlags |= lnwire.ChanUpdateDirection
|
||||
}
|
||||
edgePolicy := &channeldb.ChannelEdgePolicy{
|
||||
SigBytes: testSig.Serialize(),
|
||||
MessageFlags: msgFlags,
|
||||
@@ -551,10 +558,13 @@ func createTestGraphFromChannels(testChannels []*testChannel, source string) (
|
||||
if testChannel.Node2.MaxHTLC != 0 {
|
||||
msgFlags |= lnwire.ChanUpdateOptionMaxHtlc
|
||||
}
|
||||
channelFlags := lnwire.ChanUpdateDirection
|
||||
channelFlags := lnwire.ChanUpdateChanFlags(0)
|
||||
if testChannel.Node2.Disabled {
|
||||
channelFlags |= lnwire.ChanUpdateDisabled
|
||||
}
|
||||
if testChannel.Node2.Direction {
|
||||
channelFlags |= lnwire.ChanUpdateDirection
|
||||
}
|
||||
edgePolicy := &channeldb.ChannelEdgePolicy{
|
||||
SigBytes: testSig.Serialize(),
|
||||
MessageFlags: msgFlags,
|
||||
|
Reference in New Issue
Block a user