1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 14:22:39 +01:00

Update local node_announcement on startup (#564)

This fixes a regression that was introduced when we stopped
re-validating all channels at startup.

Fixes #563.
This commit is contained in:
Pierre-Marie Padiou 2018-04-17 19:21:33 +02:00 committed by GitHub
parent 4db5564ada
commit 410e005703
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,6 +125,12 @@ class Router(nodeParams: NodeParams, watcher: ActorRef) extends FSM[State, Data]
val fundingOutputScript = write(pay2wsh(Scripts.multiSig2of2(PublicKey(c.bitcoinKey1), PublicKey(c.bitcoinKey2))))
watcher ! WatchSpentBasic(self, txid, outputIndex, fundingOutputScript, BITCOIN_FUNDING_EXTERNAL_CHANNEL_SPENT(c.shortChannelId))
}
// on restart we update our node announcement
// note that if we don't currently have public channels, this will be ignored
val nodeAnn = Announcements.makeNodeAnnouncement(nodeParams.privateKey, nodeParams.alias, nodeParams.color, nodeParams.publicAddresses)
self ! nodeAnn
log.info(s"initialization completed, ready to process messages")
startWith(NORMAL, Data(initNodes, initChannels, initChannelUpdates, Stash(Map.empty, Map.empty), rebroadcast = Rebroadcast(channels = Map.empty, updates = Map.empty, nodes = Map.empty), awaiting = Map.empty, privateChannels = Map.empty, privateUpdates = Map.empty, excludedChannels = Set.empty, graph))
}
@ -236,8 +242,6 @@ class Router(nodeParams: NodeParams, watcher: ActorRef) extends FSM[State, Data]
db.addChannel(c, tx.txid, capacity)
// in case we just validated our first local channel, we announce the local node
// note that this will also make sure we always update our node announcement on restart (eg: alias, color), because
// even if we had stored a previous announcement, it would be overridden by this more recent one
if (!d0.nodes.contains(nodeParams.nodeId) && isRelatedTo(c, nodeParams.nodeId)) {
log.info("first local channel validated, announcing local node")
val nodeAnn = Announcements.makeNodeAnnouncement(nodeParams.privateKey, nodeParams.alias, nodeParams.color, nodeParams.publicAddresses)