Skip to content
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

[1/7] lnwire: add new Gossip 1.75 messages #8044

Merged
merged 22 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
05d76b6
multi: rename AnnounceSignatures to AnnounceSignatures1
ellemouton Aug 21, 2024
bb44efa
multi: rename ChannelAnnouncement to ChannelAnnouncment1
ellemouton Aug 21, 2024
60f331e
multi: rename ChannelUpdate to ChannelUpdate1
ellemouton Aug 21, 2024
60b0e46
lnwire: add btc and node announcement nonces to channel_ready
ellemouton Aug 21, 2024
df65b7c
lnwire: add FirstBlock and BlockRange to GossipTimestampRange
ellemouton Jan 8, 2024
f230e2c
lnwire: add AnnounceSignatures interface
ellemouton Oct 26, 2023
9be84c1
graph+lnwallet: move FetchTx logic to lnwallet
ellemouton Sep 2, 2024
a6bf76a
discovery+lnwallet: add fetchPKScript helper to gossiper
ellemouton Sep 2, 2024
615db1f
multi: move channel announcement validation to netann
ellemouton Sep 11, 2024
e07d235
lnwire: add a ChannelAnnouncement interface
ellemouton Sep 11, 2024
7bbf896
multi: move ChannelUpdate validate methods to netann
ellemouton Sep 11, 2024
34e9ee1
lnwire: lnwire: add a ChannelUpdate interface
ellemouton Sep 11, 2024
35d0c61
netann: let ValidateChannelAnn take the new interface
ellemouton Sep 11, 2024
ced88a9
netann: let ChannelUpdate validate methods take in the new interface
ellemouton Sep 11, 2024
0b4e5a0
lnwire: add AnnounceSignatures2 message
ellemouton Sep 29, 2023
66302ce
lnwire: make RawFeatureVector a Record producer
ellemouton Aug 21, 2024
a438eb3
lnwire: add ChannelAnnouncement2 message
ellemouton Sep 29, 2023
5fc1da3
netann: add MsgHash helper
ellemouton Oct 26, 2023
21c9ef8
netann: validation and verification funcs for ChannelAnnouncement2
ellemouton Sep 11, 2024
580c104
lnwire: add ChannelUpdate2
ellemouton Sep 29, 2023
a62201b
netann: add chan update 2 validate and verify funcs
ellemouton Sep 11, 2024
077273e
docs: update release notes
ellemouton Aug 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions channeldb/waitingproof.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@ type WaitingProofKey [9]byte
// needed to make channel proof exchange persistent, so that after client
// restart we may receive remote/local half proof and process it.
type WaitingProof struct {
*lnwire.AnnounceSignatures
*lnwire.AnnounceSignatures1
ellemouton marked this conversation as resolved.
Show resolved Hide resolved
isRemote bool
}

// NewWaitingProof constructs a new waiting prof instance.
func NewWaitingProof(isRemote bool, proof *lnwire.AnnounceSignatures) *WaitingProof {
func NewWaitingProof(isRemote bool,
proof *lnwire.AnnounceSignatures1) *WaitingProof {

return &WaitingProof{
AnnounceSignatures: proof,
isRemote: isRemote,
AnnounceSignatures1: proof,
isRemote: isRemote,
}
}

Expand Down Expand Up @@ -238,7 +240,7 @@ func (p *WaitingProof) Encode(w io.Writer) error {
return fmt.Errorf("expect io.Writer to be *bytes.Buffer")
}

if err := p.AnnounceSignatures.Encode(buf, 0); err != nil {
if err := p.AnnounceSignatures1.Encode(buf, 0); err != nil {
return err
}

Expand All @@ -252,11 +254,12 @@ func (p *WaitingProof) Decode(r io.Reader) error {
return err
}

msg := &lnwire.AnnounceSignatures{}
msg := &lnwire.AnnounceSignatures1{}
if err := msg.Decode(r, 0); err != nil {
return err
}

(*p).AnnounceSignatures = msg
p.AnnounceSignatures1 = msg

return nil
}
2 changes: 1 addition & 1 deletion channeldb/waitingproof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestWaitingProofStore(t *testing.T) {
db, err := MakeTestDB(t)
require.NoError(t, err, "failed to make test database")

proof1 := NewWaitingProof(true, &lnwire.AnnounceSignatures{
proof1 := NewWaitingProof(true, &lnwire.AnnounceSignatures1{
NodeSignature: wireSig,
BitcoinSignature: wireSig,
ExtraOpaqueData: make([]byte, 0),
Expand Down
12 changes: 6 additions & 6 deletions discovery/chan_series.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/graph"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/netann"
"github.com/lightningnetwork/lnd/routing/route"
Expand Down Expand Up @@ -61,7 +60,8 @@ type ChannelGraphTimeSeries interface {
// specified short channel ID. If no channel updates are known for the
// channel, then an empty slice will be returned.
FetchChanUpdates(chain chainhash.Hash,
shortChanID lnwire.ShortChannelID) ([]*lnwire.ChannelUpdate, error)
shortChanID lnwire.ShortChannelID) ([]*lnwire.ChannelUpdate1,
error)
}

// ChanSeries is an implementation of the ChannelGraphTimeSeries
Expand Down Expand Up @@ -136,7 +136,7 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
if edge1 != nil {
// We don't want to send channel updates that don't
// conform to the spec (anymore).
err := graph.ValidateChannelUpdateFields(0, edge1)
err := netann.ValidateChannelUpdateFields(0, edge1)
if err != nil {
log.Errorf("not sending invalid channel "+
"update %v: %v", edge1, err)
Expand All @@ -145,7 +145,7 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
}
}
if edge2 != nil {
err := graph.ValidateChannelUpdateFields(0, edge2)
err := netann.ValidateChannelUpdateFields(0, edge2)
if err != nil {
log.Errorf("not sending invalid channel "+
"update %v: %v", edge2, err)
Expand Down Expand Up @@ -326,7 +326,7 @@ func (c *ChanSeries) FetchChanAnns(chain chainhash.Hash,
//
// NOTE: This is part of the ChannelGraphTimeSeries interface.
func (c *ChanSeries) FetchChanUpdates(chain chainhash.Hash,
shortChanID lnwire.ShortChannelID) ([]*lnwire.ChannelUpdate, error) {
shortChanID lnwire.ShortChannelID) ([]*lnwire.ChannelUpdate1, error) {

chanInfo, e1, e2, err := c.graph.FetchChannelEdgesByID(
shortChanID.ToUint64(),
Expand All @@ -335,7 +335,7 @@ func (c *ChanSeries) FetchChanUpdates(chain chainhash.Hash,
return nil, err
}

chanUpdates := make([]*lnwire.ChannelUpdate, 0, 2)
chanUpdates := make([]*lnwire.ChannelUpdate1, 0, 2)
if e1 != nil {
chanUpdate, err := netann.ChannelUpdateFromEdge(chanInfo, e1)
if err != nil {
Expand Down
Loading
Loading