discovery+funding: update wire message usage to latest API changes
This commit is contained in:
parent
08a95ead6a
commit
0ab1c47d31
@ -369,7 +369,7 @@ func (d *AuthenticatedGossiper) networkHandler() {
|
||||
// Iterate over our channels and construct the
|
||||
// announcements array.
|
||||
err := d.cfg.Router.ForAllOutgoingChannels(func(p *channeldb.ChannelEdgePolicy) error {
|
||||
c := &lnwire.ChannelUpdateAnnouncement{
|
||||
c := &lnwire.ChannelUpdate{
|
||||
Signature: p.Signature,
|
||||
ShortChannelID: lnwire.NewShortChanIDFromInt(p.ChannelID),
|
||||
Timestamp: uint32(p.LastUpdate.Unix()),
|
||||
@ -561,7 +561,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []l
|
||||
// A new authenticated channel edge update has arrived. This indicates
|
||||
// that the directional information for an already known channel has
|
||||
// been updated.
|
||||
case *lnwire.ChannelUpdateAnnouncement:
|
||||
case *lnwire.ChannelUpdate:
|
||||
blockHeight := msg.ShortChannelID.BlockHeight
|
||||
shortChanID := msg.ShortChannelID.ToUint64()
|
||||
|
||||
@ -662,8 +662,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []l
|
||||
prefix = "remote"
|
||||
}
|
||||
|
||||
log.Infof("Received new channel announcement: %v",
|
||||
spew.Sdump(msg))
|
||||
log.Infof("Received new channel announcement: %v", spew.Sdump(msg))
|
||||
|
||||
// By the specification, channel announcement proofs should be
|
||||
// sent after some number of confirmations after channel was
|
||||
@ -721,7 +720,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(nMsg *networkMsg) []l
|
||||
key := newProofKey(chanInfo.ChannelID, nMsg.isRemote)
|
||||
d.waitingProofs[key] = msg
|
||||
|
||||
// If proof was sent b a local sub-system, then we'll
|
||||
// If proof was sent by a local sub-system, then we'll
|
||||
// send the announcement signature to the remote node
|
||||
// so they can also reconstruct the full channel
|
||||
// announcement.
|
||||
@ -863,17 +862,12 @@ func (d *AuthenticatedGossiper) synchronizeWithNode(syncReq *syncRequest) error
|
||||
// for the announcement we originally retrieved.
|
||||
var numNodes uint32
|
||||
if err := d.cfg.Router.ForEachNode(func(node *channeldb.LightningNode) error {
|
||||
alias, err := lnwire.NewAlias(node.Alias)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ann := &lnwire.NodeAnnouncement{
|
||||
Signature: node.AuthSig,
|
||||
Timestamp: uint32(node.LastUpdate.Unix()),
|
||||
Addresses: node.Addresses,
|
||||
NodeID: node.PubKey,
|
||||
Alias: alias,
|
||||
Alias: lnwire.NewAlias(node.Alias),
|
||||
Features: node.Features,
|
||||
}
|
||||
announceMessages = append(announceMessages, ann)
|
||||
|
@ -43,7 +43,7 @@ func (k waitingProofKey) ToBytes() []byte {
|
||||
func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
|
||||
chanInfo *channeldb.ChannelEdgeInfo,
|
||||
e1, e2 *channeldb.ChannelEdgePolicy) (*lnwire.ChannelAnnouncement,
|
||||
*lnwire.ChannelUpdateAnnouncement, *lnwire.ChannelUpdateAnnouncement) {
|
||||
*lnwire.ChannelUpdate, *lnwire.ChannelUpdate) {
|
||||
|
||||
// First, using the parameters of the channel, along with the channel
|
||||
// authentication chanProof, we'll create re-create the original
|
||||
@ -68,9 +68,9 @@ func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
|
||||
// Since it's up to a node's policy as to whether they advertise the
|
||||
// edge in dire direction, we don't create an advertisement if the edge
|
||||
// is nil.
|
||||
var edge1Ann, edge2Ann *lnwire.ChannelUpdateAnnouncement
|
||||
var edge1Ann, edge2Ann *lnwire.ChannelUpdate
|
||||
if e1 != nil {
|
||||
edge1Ann = &lnwire.ChannelUpdateAnnouncement{
|
||||
edge1Ann = &lnwire.ChannelUpdate{
|
||||
Signature: e1.Signature,
|
||||
ShortChannelID: chanID,
|
||||
Timestamp: uint32(e1.LastUpdate.Unix()),
|
||||
@ -82,7 +82,7 @@ func createChanAnnouncement(chanProof *channeldb.ChannelAuthProof,
|
||||
}
|
||||
}
|
||||
if e2 != nil {
|
||||
edge2Ann = &lnwire.ChannelUpdateAnnouncement{
|
||||
edge2Ann = &lnwire.ChannelUpdate{
|
||||
Signature: e2.Signature,
|
||||
ShortChannelID: chanID,
|
||||
Timestamp: uint32(e2.LastUpdate.Unix()),
|
||||
@ -120,7 +120,7 @@ func SignAnnouncement(signer lnwallet.MessageSigner, pubKey *btcec.PublicKey,
|
||||
switch m := msg.(type) {
|
||||
case *lnwire.ChannelAnnouncement:
|
||||
data, err = m.DataToSign()
|
||||
case *lnwire.ChannelUpdateAnnouncement:
|
||||
case *lnwire.ChannelUpdate:
|
||||
data, err = m.DataToSign()
|
||||
case *lnwire.NodeAnnouncement:
|
||||
data, err = m.DataToSign()
|
||||
|
@ -72,7 +72,7 @@ func (d *AuthenticatedGossiper) validateNodeAnn(a *lnwire.NodeAnnouncement) erro
|
||||
// checking that the included signature covers he announcement and has been
|
||||
// signed by the node's private key.
|
||||
func (d *AuthenticatedGossiper) validateChannelUpdateAnn(pubKey *btcec.PublicKey,
|
||||
a *lnwire.ChannelUpdateAnnouncement) error {
|
||||
a *lnwire.ChannelUpdate) error {
|
||||
|
||||
data, err := a.DataToSign()
|
||||
if err != nil {
|
||||
|
@ -1051,7 +1051,7 @@ type channelProof struct {
|
||||
// send out to the network after a new channel has been created locally.
|
||||
type chanAnnouncement struct {
|
||||
chanAnn *lnwire.ChannelAnnouncement
|
||||
chanUpdateAnn *lnwire.ChannelUpdateAnnouncement
|
||||
chanUpdateAnn *lnwire.ChannelUpdate
|
||||
chanProof *lnwire.AnnounceSignatures
|
||||
}
|
||||
|
||||
@ -1107,7 +1107,7 @@ func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey *btcec.Pu
|
||||
}
|
||||
|
||||
// TODO(roasbeef): populate proper FeeSchema
|
||||
chanUpdateAnn := &lnwire.ChannelUpdateAnnouncement{
|
||||
chanUpdateAnn := &lnwire.ChannelUpdate{
|
||||
ShortChannelID: shortChanID,
|
||||
Timestamp: uint32(time.Now().Unix()),
|
||||
Flags: chanFlags,
|
||||
|
Loading…
Reference in New Issue
Block a user