-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Aux feature bits #10182
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
Merged
Roasbeef
merged 8 commits into
lightningnetwork:master
from
GeorgeTsagk:aux-feature-bits
Sep 25, 2025
Merged
Aux feature bits #10182
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
44406db
lnwallet: introduce AuxChannelNegotiator interface
GeorgeTsagk 56c5606
lnd: add AuxChannelNegotiator to AuxComponents
GeorgeTsagk 7724d0f
lnwire: add custom records to init
GeorgeTsagk 68bd35f
lnwire: update tests for init message
GeorgeTsagk 6dff1bd
htlcswitch+peer: set and read aux custom records
GeorgeTsagk be41345
lnwallet: include peer pub key in aux chan state
GeorgeTsagk a58a52e
funding: notify aux negotiator on ChannelReady
GeorgeTsagk 2302deb
docs: add release note
GeorgeTsagk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package lnwallet | ||
|
|
||
| import ( | ||
| "github.com/lightningnetwork/lnd/lnwire" | ||
| "github.com/lightningnetwork/lnd/routing/route" | ||
| ) | ||
|
|
||
| // AuxChannelNegotiator is an interface that allows aux channel implementations | ||
| // to inject or handle custom records in the init message that is used when | ||
| // establishing a connection with a peer. It may also notify the aux channel | ||
| // implementation for the channel ready or channel reestablish events, which | ||
| // mark the channel as ready to use. | ||
| type AuxChannelNegotiator interface { | ||
| // GetInitRecords is called when sending an init message to a peer. | ||
| // It returns custom records to include in the init message TLVs. The | ||
| // implementation can decide which records to include based on the peer | ||
| // identity. | ||
| GetInitRecords(peer route.Vertex) (lnwire.CustomRecords, error) | ||
|
|
||
| // ProcessInitRecords handles received init records from a peer. The | ||
| // implementation can store state internally to affect future | ||
| // channel operations with this peer. | ||
| ProcessInitRecords(peer route.Vertex, | ||
| customRecords lnwire.CustomRecords) error | ||
|
|
||
| // ProcessChannelReady handles the event of marking a channel identified | ||
| // by its channel ID as ready to use. We also provide the peer the | ||
| // channel was established with. | ||
| ProcessChannelReady(cid lnwire.ChannelID, peer route.Vertex) | ||
|
|
||
| // ProcessReestablish handles the received channel_reestablish message | ||
| // which marks a channel identified by its cid as ready to use again. | ||
| ProcessReestablish(cid lnwire.ChannelID, peer route.Vertex) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package lnwire | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // TestInitEncodeDecode checks that we can encode and decode an Init message | ||
| // to and from a byte stream. | ||
| func TestInitEncodeDecode(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| // These are the raw bytes that we expect to be generated from the | ||
| // sample Init message. | ||
| rawBytes := []byte{ | ||
| // GlobalFeatures | ||
| 0x00, 0x01, 0xc0, | ||
|
|
||
| // Features | ||
| 0x00, 0x01, 0xc0, | ||
|
|
||
| // ExtraData - unknown odd-type TLV record. | ||
| 0x6f, // type (111) | ||
| 0x02, // length | ||
| 0x79, 0x79, // value | ||
|
|
||
| // ExtraData - custom TLV record. | ||
| // TLV record for type 67676 | ||
| 0xfe, 0x00, 0x01, 0x08, 0x6c, // type (67676) | ||
| 0x05, // length | ||
| 0x01, 0x02, 0x03, 0x04, 0x05, // value | ||
|
|
||
| // ExtraData - custom TLV record. | ||
| // TLV record for type 67777 | ||
| 0xfe, 0x00, 0x01, 0x08, 0xc1, // type (67777) | ||
| 0x03, // length | ||
| 0x01, 0x02, 0x03, // value | ||
| } | ||
|
|
||
| // Create a new empty message and decode the raw bytes into it. | ||
| msg := &Init{} | ||
| r := bytes.NewReader(rawBytes) | ||
| err := msg.Decode(r, 0) | ||
| require.NoError(t, err) | ||
|
|
||
| require.NotNil(t, msg.GlobalFeatures) | ||
| require.NotNil(t, msg.Features) | ||
| require.NotNil(t, msg.CustomRecords) | ||
| require.NotNil(t, msg.ExtraData) | ||
|
|
||
| // Next, encode the message back into a new byte buffer. | ||
| var b bytes.Buffer | ||
| err = msg.Encode(&b, 0) | ||
| require.NoError(t, err) | ||
|
|
||
| // The re-encoded bytes should be exactly the same as the original raw | ||
| // bytes. | ||
| require.Equal(t, rawBytes, b.Bytes()) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.