breacharbiter: accept handoff for live channel on peer connect

This commit modifies the interaction between the breachArbiter and the
peer struct such that the breachArbiter _always_ has the latest version
of a contract.

Prior to this commit once we connected out to a peer which we had an
active contract with and the breachArbiter was watching, we’d have two
copies of the channel in memory, instead of just a single one. This was
wasteful and caused some duplicated log messages due to two instances
of the channel being active.
This commit is contained in:
Olaoluwa Osuntokun committed 2016-12-27 16:45:05 -08:00
1 parent 507a4eb5cc
commit 3e1c98f2f7
2 files changed
+20 -6

No files matched your search

+1 -1
View File
@@ -232,7 +232,7 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
peerLog.Infof("peerID(%v) loaded ChannelPoint(%v)", p.id, chanPoint)
// TODO(roasbeef): register active channel with breach observer
p.server.breachArbiter.newContracts <- lnChan
// Register this new channel link with the HTLC Switch. This is
// necessary to properly route multi-hop payments, and forward