cryptosharks131 / lndg

Lite GUI web interface to analyze lnd data and leverage the backend database for automation tools around rebalancing and other basic maintenance tasks.
MIT License
232 stars 47 forks source link

jobs: update alias on every update_channels run #332

Closed blckbx closed 10 months ago

blckbx commented 1 year ago

This experimental PR tries to update alias on every jobs.py run by using data that has been already fetched by ListChannels(ln.ListChannelsRequest()).channels.

It's rather hard to test given that peers need to change their alias to see the effect happening in realtime.

blckbx commented 1 year ago

The change does not what it's supposed to do. And I don't know why. peer_alias is relatively new in ListChannel api call, could it be some proto type of thing?

cryptosharks131 commented 1 year ago

I tested the gRPC endpoint on v0.17 and I also do not see the peer_alias being reported back as expected. No issues getting the alias from the GetNodeInfo endpoint.

blckbx commented 1 year ago

I tested the gRPC endpoint on v0.17 and I also do not see the peer_alias being reported back as expected. No issues getting the alias from the GetNodeInfo endpoint.

https://lightning.engineering/api-docs/api/lnd/lightning/list-channels#lnrpclistchannelsrequest A special flag is required for the peer alias lookup, it's disabled by default to speed up the call. And I don't think we want this to run every 20sec.

blckbx commented 1 year ago
$ curl --insecure \
--header "Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000  .lnd/data/chain/bitcoin/mainnet/readonly.macaroon)" \
https://localhost:8080/v1/channels?peer_alias_lookup=true | jq -r '.channels[].peer_alias'

this would be the correct grpc call. we could do a daily one updating peers' aliases.

Timing (~40 chans): peer_alias_lookup=true: real 0m4,909s peer_alias_lookup=false: real 0m3,802s