Skip to content

Commit 50a0fce

Browse files
Roasbeefguggero
authored andcommitted
lndclient: expose feature bits for ListPeers resp
1 parent 5ce6a2c commit 50a0fce

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lightning_client.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,9 @@ type Peer struct {
845845

846846
// Received is the total amount we have received from this peer.
847847
Received btcutil.Amount
848+
849+
// Features is the set of the features supported by the node.
850+
Features *lnwire.FeatureVector
848851
}
849852

850853
// ChannelBalance contains information about our channel balances.
@@ -3422,6 +3425,18 @@ func (s *lightningClient) ListPeers(ctx context.Context) ([]Peer,
34223425

34233426
pingTime := time.Microsecond * time.Duration(peer.PingTime)
34243427

3428+
var featureBits []lnwire.FeatureBit
3429+
for rpcBit := range peer.Features {
3430+
featureBits = append(
3431+
featureBits, lnwire.FeatureBit(rpcBit),
3432+
)
3433+
}
3434+
3435+
peerFeatures := lnwire.NewFeatureVector(
3436+
lnwire.NewRawFeatureVector(featureBits...),
3437+
lnwire.Features,
3438+
)
3439+
34253440
peers[i] = Peer{
34263441
Pubkey: pk,
34273442
Address: peer.Address,
@@ -3431,6 +3446,7 @@ func (s *lightningClient) ListPeers(ctx context.Context) ([]Peer,
34313446
PingTime: pingTime,
34323447
Sent: btcutil.Amount(peer.SatSent),
34333448
Received: btcutil.Amount(peer.SatRecv),
3449+
Features: peerFeatures,
34343450
}
34353451
}
34363452

0 commit comments

Comments
 (0)