multi: rename AnnounceSignatures to AnnounceSignatures1
In preparation for adding a new message, AnnounceSignatures2 along with an AnnounceSignatures interface, we rename the existing message to AnnounceSignatures1.
This commit is contained in:
14 files changed
+47
-44
No files matched your search
@@ -1416,7 +1416,7 @@ func (d *AuthenticatedGossiper) networkHandler() {
|
||||
switch announcement.msg.(type) {
|
||||
// Channel announcement signatures are amongst the only
|
||||
// messages that we'll process serially.
|
||||
case *lnwire.AnnounceSignatures:
|
||||
case *lnwire.AnnounceSignatures1:
|
||||
emittedAnnouncements, _ := d.processNetworkAnnouncement(
|
||||
announcement,
|
||||
)
|
||||
@@ -2041,7 +2041,7 @@ func (d *AuthenticatedGossiper) processNetworkAnnouncement(
|
||||
// A new signature announcement has been received. This indicates
|
||||
// willingness of nodes involved in the funding of a channel to
|
||||
// announce this new channel to the rest of the world.
|
||||
case *lnwire.AnnounceSignatures:
|
||||
case *lnwire.AnnounceSignatures1:
|
||||
return d.handleAnnSig(nMsg, msg)
|
||||
|
||||
default:
|
||||
@@ -2129,7 +2129,7 @@ func (d *AuthenticatedGossiper) fetchNodeAnn(
|
||||
// MessageStore is seen as stale by the current graph.
|
||||
func (d *AuthenticatedGossiper) isMsgStale(msg lnwire.Message) bool {
|
||||
switch msg := msg.(type) {
|
||||
case *lnwire.AnnounceSignatures:
|
||||
case *lnwire.AnnounceSignatures1:
|
||||
chanInfo, _, _, err := d.cfg.Graph.GetChannelByID(
|
||||
msg.ShortChannelID,
|
||||
)
|
||||
@@ -3200,7 +3200,7 @@ func (d *AuthenticatedGossiper) handleChanUpdate(nMsg *networkMsg,
|
||||
|
||||
// handleAnnSig processes a new announcement signatures message.
|
||||
func (d *AuthenticatedGossiper) handleAnnSig(nMsg *networkMsg,
|
||||
ann *lnwire.AnnounceSignatures) ([]networkMsg, bool) {
|
||||
ann *lnwire.AnnounceSignatures1) ([]networkMsg, bool) {
|
||||
|
||||
needBlockHeight := ann.ShortChannelID.BlockHeight +
|
||||
d.cfg.ProofMatureDelta
|
||||
|
||||
@@ -481,8 +481,8 @@ type annBatch struct {
|
||||
chanUpdAnn1 *lnwire.ChannelUpdate
|
||||
chanUpdAnn2 *lnwire.ChannelUpdate
|
||||
|
||||
localProofAnn *lnwire.AnnounceSignatures
|
||||
remoteProofAnn *lnwire.AnnounceSignatures
|
||||
localProofAnn *lnwire.AnnounceSignatures1
|
||||
remoteProofAnn *lnwire.AnnounceSignatures1
|
||||
}
|
||||
|
||||
func createLocalAnnouncements(blockHeight uint32) (*annBatch, error) {
|
||||
@@ -513,7 +513,7 @@ func createAnnouncements(blockHeight uint32, key1, key2 *btcec.PrivateKey) (*ann
|
||||
return nil, err
|
||||
}
|
||||
|
||||
batch.remoteProofAnn = &lnwire.AnnounceSignatures{
|
||||
batch.remoteProofAnn = &lnwire.AnnounceSignatures1{
|
||||
ShortChannelID: lnwire.ShortChannelID{
|
||||
BlockHeight: blockHeight,
|
||||
},
|
||||
@@ -521,7 +521,7 @@ func createAnnouncements(blockHeight uint32, key1, key2 *btcec.PrivateKey) (*ann
|
||||
BitcoinSignature: batch.chanAnn.BitcoinSig2,
|
||||
}
|
||||
|
||||
batch.localProofAnn = &lnwire.AnnounceSignatures{
|
||||
batch.localProofAnn = &lnwire.AnnounceSignatures1{
|
||||
ShortChannelID: lnwire.ShortChannelID{
|
||||
BlockHeight: blockHeight,
|
||||
},
|
||||
@@ -1540,7 +1540,7 @@ out:
|
||||
case msg := <-sentToPeer:
|
||||
// Since the ChannelUpdate will also be resent as it is
|
||||
// sent reliably, we'll need to filter it out.
|
||||
if _, ok := msg.(*lnwire.AnnounceSignatures); !ok {
|
||||
if _, ok := msg.(*lnwire.AnnounceSignatures1); !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -3302,7 +3302,7 @@ func TestSendChannelUpdateReliably(t *testing.T) {
|
||||
switch msg := msg.(type) {
|
||||
case *lnwire.ChannelUpdate:
|
||||
assertMessage(t, staleChannelUpdate, msg)
|
||||
case *lnwire.AnnounceSignatures:
|
||||
case *lnwire.AnnounceSignatures1:
|
||||
assertMessage(t, batch.localProofAnn, msg)
|
||||
default:
|
||||
t.Fatalf("send unexpected %v message", msg.MsgType())
|
||||
|
||||
@@ -83,7 +83,7 @@ func NewMessageStore(db kvdb.Backend) (*MessageStore, error) {
|
||||
func msgShortChanID(msg lnwire.Message) (lnwire.ShortChannelID, error) {
|
||||
var shortChanID lnwire.ShortChannelID
|
||||
switch msg := msg.(type) {
|
||||
case *lnwire.AnnounceSignatures:
|
||||
case *lnwire.AnnounceSignatures1:
|
||||
shortChanID = msg.ShortChannelID
|
||||
case *lnwire.ChannelUpdate:
|
||||
shortChanID = msg.ShortChannelID
|
||||
|
||||
@@ -52,8 +52,8 @@ func randCompressedPubKey(t *testing.T) [33]byte {
|
||||
return compressedPubKey
|
||||
}
|
||||
|
||||
func randAnnounceSignatures() *lnwire.AnnounceSignatures {
|
||||
return &lnwire.AnnounceSignatures{
|
||||
func randAnnounceSignatures() *lnwire.AnnounceSignatures1 {
|
||||
return &lnwire.AnnounceSignatures1{
|
||||
ShortChannelID: lnwire.NewShortChanIDFromInt(rand.Uint64()),
|
||||
ExtraOpaqueData: make([]byte, 0),
|
||||
}
|
||||
@@ -116,7 +116,7 @@ func TestMessageStoreMessages(t *testing.T) {
|
||||
for _, msg := range peerMsgs {
|
||||
var shortChanID uint64
|
||||
switch msg := msg.(type) {
|
||||
case *lnwire.AnnounceSignatures:
|
||||
case *lnwire.AnnounceSignatures1:
|
||||
shortChanID = msg.ShortChannelID.ToUint64()
|
||||
case *lnwire.ChannelUpdate:
|
||||
shortChanID = msg.ShortChannelID.ToUint64()
|
||||
|
||||
Reference in new issue
Block a user