-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
blip-0038: block header gossip #38
base: master
Are you sure you want to change the base?
Conversation
Lightning nodes must stay in sync with the blockchain to protect themselves against malicious peers that could publish revoked commitment transactions. Honest nodes should help their peers by letting them know about the latest block header they have received. This allows detecting when a node is behind and may need to fix their bitcoin node. We extend lightning messages to include information about the last header we've received and the corresponding block height.
If we're just gonna include this once, should we include a proof that the given header is at the given height with a coinbase merkle path? I dunno maybe that means some nodes can't provide the proof, but giving a height value that can't be verified at all isn't that useful, in many cases :/ |
I think we'll want to include it in But it's probably a good idea to include whatever proof would help to validate the height, I'll need to look into this! |
The current |
This is directly encoded inside the Can you detail why that encoding was chosen? It feels like using an empty |
I would guess that this is a case of "let's just prepare the code to be able to send a custom ping payload but then discuss the actual format at a later point", since we don't currently even look at the payload on the other side, it's just being logged (on I do agree that using TLV here definitely makes sense. |
Yeah it's just directly encoded, as there's no existing structure defined in the ping messages. Just as the requirement of
Up until now, there've been no readers 🤷 , they'd identify the payload based on the 80 byte length, and potentially knowledge of the prev block header referenced. |
|
||
## Specification | ||
|
||
We add the following TLV field to the `init` message: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An init
message is only sent once when the connection is established. Putting the payload in ping
would mean that the new headers can continually be sent and monitored.
To allow implementations to more easily distinguish the header message amidst a string of other random bytes in the payload, perhaps we can add special marker/magic bytes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see two possible designs for this:
- keep the body of the
ping
messages random and include the block header in the message's tlv stream - make the body of the
ping
message a TLV stream, that contains the block header (+ padding)
Lightning nodes must stay in sync with the blockchain to protect themselves against malicious peers that could publish revoked commitment transactions. Honest nodes should help their peers by letting them know about the latest block header they have received. This allows detecting when a node is behind and may need to fix their bitcoin node.
We extend lightning messages to include information about the last header we've received and the corresponding block height.
@Roasbeef can you detail what lnd is doing regarding this feature? You mentioned encoding it in
ping
andpong
, but what exactly do you include?