Expose node features in GetNodeInfoResponse#231
Conversation
|
👋 Thanks for assigning @benthecarman as a reviewer! |
|
We just get a list like this would be better if this had some more info, at least giving the name of each feature so we knew what it represented |
da2670e to
795b695
Compare
|
🔔 1st Reminder Hey @benthecarman! This PR has been waiting for your review. |
There was a problem hiding this comment.
this format is still weird..
We have the name as the key and we put it in the name field. is_known and is_supported are both always true as the way we get them makes it inherent.
Also doesn't make it entirely clear if we are signaling the required or optional bit, just that we are signaling one of them.
We also don't need the node object here
"features": {
"node": {
"DataLossProtect": {
"name": "DataLossProtect",
"is_supported": true,
"is_required": true,
"is_known": true,
"supported_bit": 1,
"required_bit": 0
},
lnd does a good job of this, where the bit is the key and the data is available about it. They have is_known because you can optionally flag bits on in their config, we don't support this so we don't need this field.
"features": {
"0": {
"name": "data-loss-protect",
"is_required": true,
"is_known": true
},
"5": {
"name": "upfront-shutdown-script",
"is_required": false,
"is_known": true
},
| supported_bit, | ||
| required_bit, | ||
| }); | ||
| feature.is_supported = true; |
There was a problem hiding this comment.
we are always setting this to true, do we even need this field?
Fair point. I agree that it's clunky and will switch this to LND's bit-keyed style.
I added the {
"ourFeatures": {
"init": "800898880a8a59a1",
"node": "808898880a8a59a1",
"channel": "",
"invoice": "02000002024100"
}
}The shape I had in mind was something like this, but with decoded, instead of raw bytes: {
"init": {
"0": { "name": "DataLossProtect", "is_required": true },
"5": { "name": "UpfrontShutdownScript", "is_required": false },
"8": { "name": "VarOnionOptin", "is_required": true }
},
"node": {
"0": { "name": "DataLossProtect", "is_required": true },
"55": { "name": "Keysend", "is_required": false }
},
"invoice": {
"8": { "name": "VarOnionOptin", "is_required": true },
"14": { "name": "PaymentSecret", "is_required": true }
}
}That said, since this response currently only exposes node-announcement features, I'm fine flattening it for now and adding contextual grouping later if we expose the other feature sets. |
795b695 to
c68ae6d
Compare
|
Awesome looks good! Can we just sort the features by their bit, currently they are random from the hash map. Feel free to do that in a squash and we should be able to get this in! |
Return the node-announcement feature set from GetNodeInfoResponse so clients can inspect advertised node capabilities, such as keysend support, directly from the node info API. Decode exposed feature bytes into semantic entries keyed by the signaled BOLT feature bit. Each entry carries the decoded name and whether that bit is required, while presence in the map indicates the bit is signaled.
c68ae6d to
45c6516
Compare
We have feature ordering by bit now by replacing the |
What this PR does:
To run payment-activity simulations against networks of
ldk-servernodes, clients such assim-lnneed to know whether a server advertises support for capabilities likekeysendin itsnode_announcement.This PR exposes node-announcement features through
GetNodeInfoResponse.features, allowing clients to query the node directly for its advertised feature set. For now, only node-announcement features are populated; the proto documentation reflects this narrower contract while leaving room for future expansion to other feature contexts.This is needed by the ongoing
sim-lnwork in bitcoin-dev-project/sim-ln#307.