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

Gossip #95

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
efabd2f
multi: rename AnnounceSignatures to AnnounceSignatures1
ellemouton Oct 26, 2023
a94a23c
multi: rename ChannelAnnouncement to ChannelAnnouncment1
ellemouton Oct 26, 2023
5edb0c9
multi: rename ChannelUpdate to ChannelUpdate1
ellemouton Oct 26, 2023
b86dd40
multi: rename NodeAnnouncement
ellemouton Oct 26, 2023
3156421
lnwire: make MuSig2Nonce TLV type re-usable
ellemouton Sep 29, 2023
8b62443
lnwire: add RawFeatureVectorRecordProducer
ellemouton Sep 29, 2023
1244c8d
lnwire: add Encode and Pack methods for tlv.Records
ellemouton Sep 29, 2023
96907a1
lnwire: use the RawFeatureVector record methods for ChannelType
ellemouton Sep 29, 2023
fc71936
lnwire: make ShortChannelID type re-usable
ellemouton Sep 29, 2023
83da688
lnwire: add btc and node announcement nonces to channel_ready
ellemouton Sep 29, 2023
0e50cf0
lnwire: add FirstBlock and BlockRange to GossipTimestampRange
ellemouton Oct 26, 2023
7bc9dcf
lnwire: add AnnounceSignatures interface
ellemouton Oct 26, 2023
03347bf
lnwire: add a ChannelAnnouncement interface
ellemouton Oct 26, 2023
804f7f8
lnwire: add a ChannelUpdate interface
ellemouton Oct 26, 2023
c45525f
lnwire: add MsgHash helper
ellemouton Oct 26, 2023
9d0c372
lnwire: add AnnounceSignatures2 message
ellemouton Sep 29, 2023
0f129a4
lnwire: add ChannelAnnouncement2 message
ellemouton Sep 29, 2023
695c431
lnwire: introduce the BooleanRecordProducer
ellemouton Sep 29, 2023
8c08665
lnwire: add ChannelUpdate2
ellemouton Sep 29, 2023
e2c260b
lnwire: add NodeAnnouncement2
ellemouton Sep 29, 2023
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
6 changes: 3 additions & 3 deletions channeldb/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -2735,8 +2735,8 @@ func (l *LightningNode) AddPubKey(key *btcec.PublicKey) {
}

// NodeAnnouncement retrieves the latest node announcement of the node.
func (l *LightningNode) NodeAnnouncement(signed bool) (*lnwire.NodeAnnouncement,
error) {
func (l *LightningNode) NodeAnnouncement(signed bool) (
*lnwire.NodeAnnouncement1, error) {

if !l.HaveNodeAnnouncement {
return nil, fmt.Errorf("node does not have node announcement")
Expand All @@ -2747,7 +2747,7 @@ func (l *LightningNode) NodeAnnouncement(signed bool) (*lnwire.NodeAnnouncement,
return nil, err
}

nodeAnn := &lnwire.NodeAnnouncement{
nodeAnn := &lnwire.NodeAnnouncement1{
Features: l.Features.RawFeatureVector,
NodeID: l.PubKeyBytes,
RGBColor: l.Color,
Expand Down
2 changes: 1 addition & 1 deletion channeldb/migration/lnwire21/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (t MessageType) String() string {
case MsgPing:
return "Ping"
case MsgAnnounceSignatures:
return "AnnounceSignatures"
return "AnnounceSignatures1"
case MsgPong:
return "Pong"
case MsgUpdateFee:
Expand Down
2 changes: 1 addition & 1 deletion channeldb/models/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (k CircuitKey) String() string {
// constraints will be consulted in order to ensure that adequate fees are
// paid, and our time-lock parameters are respected. In the event that an
// incoming HTLC violates any of these constraints, it is to be _rejected_ with
// the error possibly carrying along a ChannelUpdate message that includes the
// the error possibly carrying along a ChannelUpdate1 message that includes the
// latest policy.
type ForwardingPolicy struct {
// MinHTLCOut is the smallest HTLC that is to be forwarded.
Expand Down
21 changes: 10 additions & 11 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
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,11 +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 {
return err
}

return nil
return p.AnnounceSignatures1.Encode(buf, 0)
}

// Decode reads the data from the byte stream and initializes the
Expand All @@ -252,11 +250,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
11 changes: 6 additions & 5 deletions discovery/chan_series.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type ChannelGraphTimeSeries interface {
// their updates that match the set of specified short channel ID's.
// We'll use this to reply to a QueryShortChanIDs message sent by a
// remote peer. The response will contain a unique set of
// ChannelAnnouncements, the latest ChannelUpdate for each of the
// ChannelAnnouncements, the latest ChannelUpdate1 for each of the
// announcements, and a unique set of NodeAnnouncements.
FetchChanAnns(chain chainhash.Hash,
shortChanIDs []lnwire.ShortChannelID) ([]lnwire.Message, error)
Expand All @@ -59,7 +59,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 @@ -235,7 +236,7 @@ func (c *ChanSeries) FilterChannelRange(chain chainhash.Hash,
// FetchChanAnns returns a full set of channel announcements as well as their
// updates that match the set of specified short channel ID's. We'll use this
// to reply to a QueryShortChanIDs message sent by a remote peer. The response
// will contain a unique set of ChannelAnnouncements, the latest ChannelUpdate
// will contain a unique set of ChannelAnnouncements, the latest ChannelUpdate1
// for each of the announcements, and a unique set of NodeAnnouncements.
//
// NOTE: This is part of the ChannelGraphTimeSeries interface.
Expand Down Expand Up @@ -324,7 +325,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 @@ -333,7 +334,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