multi: rename ChannelUpdate to ChannelUpdate1

In preparation for adding a new ChannelUpdate2 message and a
ChannelUpdate interface, we rename the existing message to
ChannelUpdate1.
This commit is contained in:
Elle Mouton
2024-08-21 08:39:37 +02:00
parent bb44efa21f
commit 60f331edb1
43 changed files with 198 additions and 172 deletions

View File

@@ -478,8 +478,8 @@ type annBatch struct {
chanAnn *lnwire.ChannelAnnouncement1
chanUpdAnn1 *lnwire.ChannelUpdate
chanUpdAnn2 *lnwire.ChannelUpdate
chanUpdAnn1 *lnwire.ChannelUpdate1
chanUpdAnn2 *lnwire.ChannelUpdate1
localProofAnn *lnwire.AnnounceSignatures1
remoteProofAnn *lnwire.AnnounceSignatures1
@@ -585,12 +585,12 @@ func createNodeAnnouncement(priv *btcec.PrivateKey,
func createUpdateAnnouncement(blockHeight uint32,
flags lnwire.ChanUpdateChanFlags,
nodeKey *btcec.PrivateKey, timestamp uint32,
extraBytes ...[]byte) (*lnwire.ChannelUpdate, error) {
extraBytes ...[]byte) (*lnwire.ChannelUpdate1, error) {
var err error
htlcMinMsat := lnwire.MilliSatoshi(prand.Int63())
a := &lnwire.ChannelUpdate{
a := &lnwire.ChannelUpdate1{
ShortChannelID: lnwire.ShortChannelID{
BlockHeight: blockHeight,
},
@@ -618,7 +618,7 @@ func createUpdateAnnouncement(blockHeight uint32,
return a, nil
}
func signUpdate(nodeKey *btcec.PrivateKey, a *lnwire.ChannelUpdate) error {
func signUpdate(nodeKey *btcec.PrivateKey, a *lnwire.ChannelUpdate1) error {
signer := mock.SingleSigner{Privkey: nodeKey}
sig, err := netann.SignAnnouncement(&signer, testKeyLoc, a)
if err != nil {
@@ -749,7 +749,7 @@ func createTestCtx(t *testing.T, startHeight uint32, isChanPeer bool) (
return false
}
signAliasUpdate := func(*lnwire.ChannelUpdate) (*ecdsa.Signature,
signAliasUpdate := func(*lnwire.ChannelUpdate1) (*ecdsa.Signature,
error) {
return nil, nil
@@ -1462,7 +1462,7 @@ func TestSignatureAnnouncementRetryAtStartup(t *testing.T) {
return false
}
signAliasUpdate := func(*lnwire.ChannelUpdate) (*ecdsa.Signature,
signAliasUpdate := func(*lnwire.ChannelUpdate1) (*ecdsa.Signature,
error) {
return nil, nil
@@ -1868,7 +1868,7 @@ func TestDeDuplicatedAnnouncements(t *testing.T) {
t.Fatal("channel update not replaced in batch")
}
assertChannelUpdate := func(channelUpdate *lnwire.ChannelUpdate) {
assertChannelUpdate := func(channelUpdate *lnwire.ChannelUpdate1) {
channelKey := channelUpdateID{
ua3.ShortChannelID,
ua3.ChannelFlags,
@@ -2814,7 +2814,7 @@ func TestRetransmit(t *testing.T) {
switch msg.(type) {
case *lnwire.ChannelAnnouncement1:
chanAnn++
case *lnwire.ChannelUpdate:
case *lnwire.ChannelUpdate1:
chanUpd++
case *lnwire.NodeAnnouncement:
nodeAnn++
@@ -3247,7 +3247,7 @@ func TestSendChannelUpdateReliably(t *testing.T) {
// already been announced. We'll keep track of the old message that is
// now stale to use later on.
staleChannelUpdate := batch.chanUpdAnn1
newChannelUpdate := &lnwire.ChannelUpdate{}
newChannelUpdate := &lnwire.ChannelUpdate1{}
*newChannelUpdate = *staleChannelUpdate
newChannelUpdate.Timestamp++
if err := signUpdate(selfKeyPriv, newChannelUpdate); err != nil {
@@ -3301,7 +3301,7 @@ func TestSendChannelUpdateReliably(t *testing.T) {
}
switch msg := msg.(type) {
case *lnwire.ChannelUpdate:
case *lnwire.ChannelUpdate1:
assertMessage(t, staleChannelUpdate, msg)
case *lnwire.AnnounceSignatures1:
assertMessage(t, batch.localProofAnn, msg)
@@ -3505,7 +3505,7 @@ out:
// being the channel our first private channel.
for i := 0; i < numChannels-1; i++ {
assertBroadcastMsg(t, ctx, func(msg lnwire.Message) error {
upd, ok := msg.(*lnwire.ChannelUpdate)
upd, ok := msg.(*lnwire.ChannelUpdate1)
if !ok {
return fmt.Errorf("channel update not "+
"broadcast, instead %T was", msg)
@@ -3529,7 +3529,7 @@ out:
// remote peer via the reliable sender.
select {
case msg := <-sentMsgs:
upd, ok := msg.(*lnwire.ChannelUpdate)
upd, ok := msg.(*lnwire.ChannelUpdate1)
if !ok {
t.Fatalf("channel update not "+
"broadcast, instead %T was", msg)
@@ -3553,7 +3553,7 @@ out:
for {
select {
case msg := <-ctx.broadcastedMessage:
if upd, ok := msg.msg.(*lnwire.ChannelUpdate); ok {
if upd, ok := msg.msg.(*lnwire.ChannelUpdate1); ok {
if upd.ShortChannelID == firstChanID {
t.Fatalf("chan update msg received: %v",
spew.Sdump(msg))
@@ -3885,7 +3885,7 @@ func TestRateLimitChannelUpdates(t *testing.T) {
// We'll define a helper to assert whether updates should be rate
// limited or not depending on their contents.
assertRateLimit := func(update *lnwire.ChannelUpdate, peer lnpeer.Peer,
assertRateLimit := func(update *lnwire.ChannelUpdate1, peer lnpeer.Peer,
shouldRateLimit bool) {
t.Helper()