Skip to content

Commit 13a7bec

Browse files
authored
Merge pull request #8044 from ellemouton/g175Messages
[1/7] lnwire: add new Gossip 1.75 messages
2 parents 838a32d + 077273e commit 13a7bec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2618
-557
lines changed

channeldb/waitingproof.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,17 @@ type WaitingProofKey [9]byte
191191
// needed to make channel proof exchange persistent, so that after client
192192
// restart we may receive remote/local half proof and process it.
193193
type WaitingProof struct {
194-
*lnwire.AnnounceSignatures
194+
*lnwire.AnnounceSignatures1
195195
isRemote bool
196196
}
197197

198198
// NewWaitingProof constructs a new waiting prof instance.
199-
func NewWaitingProof(isRemote bool, proof *lnwire.AnnounceSignatures) *WaitingProof {
199+
func NewWaitingProof(isRemote bool,
200+
proof *lnwire.AnnounceSignatures1) *WaitingProof {
201+
200202
return &WaitingProof{
201-
AnnounceSignatures: proof,
202-
isRemote: isRemote,
203+
AnnounceSignatures1: proof,
204+
isRemote: isRemote,
203205
}
204206
}
205207

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

241-
if err := p.AnnounceSignatures.Encode(buf, 0); err != nil {
243+
if err := p.AnnounceSignatures1.Encode(buf, 0); err != nil {
242244
return err
243245
}
244246

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

255-
msg := &lnwire.AnnounceSignatures{}
257+
msg := &lnwire.AnnounceSignatures1{}
256258
if err := msg.Decode(r, 0); err != nil {
257259
return err
258260
}
259261

260-
(*p).AnnounceSignatures = msg
262+
p.AnnounceSignatures1 = msg
263+
261264
return nil
262265
}

channeldb/waitingproof_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestWaitingProofStore(t *testing.T) {
1818
db, err := MakeTestDB(t)
1919
require.NoError(t, err, "failed to make test database")
2020

21-
proof1 := NewWaitingProof(true, &lnwire.AnnounceSignatures{
21+
proof1 := NewWaitingProof(true, &lnwire.AnnounceSignatures1{
2222
NodeSignature: wireSig,
2323
BitcoinSignature: wireSig,
2424
ExtraOpaqueData: make([]byte, 0),

discovery/chan_series.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

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

6767
// ChanSeries is an implementation of the ChannelGraphTimeSeries
@@ -136,7 +136,7 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
136136
if edge1 != nil {
137137
// We don't want to send channel updates that don't
138138
// conform to the spec (anymore).
139-
err := graph.ValidateChannelUpdateFields(0, edge1)
139+
err := netann.ValidateChannelUpdateFields(0, edge1)
140140
if err != nil {
141141
log.Errorf("not sending invalid channel "+
142142
"update %v: %v", edge1, err)
@@ -145,7 +145,7 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
145145
}
146146
}
147147
if edge2 != nil {
148-
err := graph.ValidateChannelUpdateFields(0, edge2)
148+
err := netann.ValidateChannelUpdateFields(0, edge2)
149149
if err != nil {
150150
log.Errorf("not sending invalid channel "+
151151
"update %v: %v", edge2, err)
@@ -326,7 +326,7 @@ func (c *ChanSeries) FetchChanAnns(chain chainhash.Hash,
326326
//
327327
// NOTE: This is part of the ChannelGraphTimeSeries interface.
328328
func (c *ChanSeries) FetchChanUpdates(chain chainhash.Hash,
329-
shortChanID lnwire.ShortChannelID) ([]*lnwire.ChannelUpdate, error) {
329+
shortChanID lnwire.ShortChannelID) ([]*lnwire.ChannelUpdate1, error) {
330330

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

338-
chanUpdates := make([]*lnwire.ChannelUpdate, 0, 2)
338+
chanUpdates := make([]*lnwire.ChannelUpdate1, 0, 2)
339339
if e1 != nil {
340340
chanUpdate, err := netann.ChannelUpdateFromEdge(chanInfo, e1)
341341
if err != nil {

0 commit comments

Comments
 (0)