mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 06:21:40 +01:00
rpcserver: only set channel Active=true if added to htlcswitch
For a calls to ListChannels we now only set the ActiveChannel.Active=true if the link is found by the htlcswitch. This is done to be able to make it possible to tell if a newly opened channel has been added to the htlcswitch, such that we can synchronize on this during tests before we attempt to close the channel.
This commit is contained in:
parent
ae7c6c7e8f
commit
6065c763e6
1 changed files with 7 additions and 1 deletions
|
@ -1333,6 +1333,12 @@ func (r *rpcServer) ListChannels(ctx context.Context,
|
||||||
peerOnline = true
|
peerOnline = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
channelID := lnwire.NewChanIDFromOutPoint(&chanPoint)
|
||||||
|
var linkActive bool
|
||||||
|
if _, err := r.server.htlcSwitch.GetLink(channelID); err == nil {
|
||||||
|
linkActive = true
|
||||||
|
}
|
||||||
|
|
||||||
// As this is required for display purposes, we'll calculate
|
// As this is required for display purposes, we'll calculate
|
||||||
// the weight of the commitment transaction. We also add on the
|
// the weight of the commitment transaction. We also add on the
|
||||||
// estimated weight of the witness to calculate the weight of
|
// estimated weight of the witness to calculate the weight of
|
||||||
|
@ -1344,7 +1350,7 @@ func (r *rpcServer) ListChannels(ctx context.Context,
|
||||||
commitWeight := commitBaseWeight + lnwallet.WitnessCommitmentTxWeight
|
commitWeight := commitBaseWeight + lnwallet.WitnessCommitmentTxWeight
|
||||||
|
|
||||||
channel := &lnrpc.ActiveChannel{
|
channel := &lnrpc.ActiveChannel{
|
||||||
Active: peerOnline,
|
Active: peerOnline && linkActive,
|
||||||
RemotePubkey: nodeID,
|
RemotePubkey: nodeID,
|
||||||
ChannelPoint: chanPoint.String(),
|
ChannelPoint: chanPoint.String(),
|
||||||
ChanId: chanID,
|
ChanId: chanID,
|
||||||
|
|
Loading…
Add table
Reference in a new issue