Skip to content

Commit

Permalink
lndclient: expose feature bits for ListPeers resp
Browse files Browse the repository at this point in the history
  • Loading branch information
Roasbeef committed Jul 23, 2024
1 parent 0ee3ed2 commit 4de8443
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lightning_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,9 @@ type Peer struct {

// Received is the total amount we have received from this peer.
Received btcutil.Amount

// Features is the set of the features supported by the node.
Features *lnwire.FeatureVector
}

// ChannelBalance contains information about our channel balances.
Expand Down Expand Up @@ -3336,6 +3339,18 @@ func (s *lightningClient) ListPeers(ctx context.Context) ([]Peer,

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

var featureBits []lnwire.FeatureBit
for rpcBit := range peer.Features {
featureBits = append(
featureBits, lnwire.FeatureBit(rpcBit),
)
}

peerFeatures := lnwire.NewFeatureVector(
lnwire.NewRawFeatureVector(featureBits...),
lnwire.Features,
)

peers[i] = Peer{
Pubkey: pk,
Address: peer.Address,
Expand All @@ -3345,6 +3360,7 @@ func (s *lightningClient) ListPeers(ctx context.Context) ([]Peer,
PingTime: pingTime,
Sent: btcutil.Amount(peer.SatSent),
Received: btcutil.Amount(peer.SatRecv),
Features: peerFeatures,
}
}

Expand Down

0 comments on commit 4de8443

Please sign in to comment.