peer: remove no longer needed block epoch

This commit is contained in:
Wilmer Paulino 2018-06-11 19:05:00 -07:00
parent 9ecfdb3c32
commit 90a50bd893
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

22
peer.go

@ -343,11 +343,6 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
continue continue
} }
blockEpoch, err := p.server.cc.chainNotifier.RegisterBlockEpochNtfn()
if err != nil {
lnChan.Stop()
return err
}
_, currentHeight, err := p.server.cc.chainIO.GetBestBlock() _, currentHeight, err := p.server.cc.chainIO.GetBestBlock()
if err != nil { if err != nil {
lnChan.Stop() lnChan.Stop()
@ -410,8 +405,8 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
// Create the link and add it to the switch. // Create the link and add it to the switch.
err = p.addLink( err = p.addLink(
chanPoint, lnChan, forwardingPolicy, blockEpoch, chanPoint, lnChan, forwardingPolicy, chainEvents,
chainEvents, currentHeight, true, currentHeight, true,
) )
if err != nil { if err != nil {
lnChan.Stop() lnChan.Stop()
@ -430,7 +425,6 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
func (p *peer) addLink(chanPoint *wire.OutPoint, func (p *peer) addLink(chanPoint *wire.OutPoint,
lnChan *lnwallet.LightningChannel, lnChan *lnwallet.LightningChannel,
forwardingPolicy *htlcswitch.ForwardingPolicy, forwardingPolicy *htlcswitch.ForwardingPolicy,
blockEpoch *chainntnfs.BlockEpochEvent,
chainEvents *contractcourt.ChainEventSubscription, chainEvents *contractcourt.ChainEventSubscription,
currentHeight int32, syncStates bool) error { currentHeight int32, syncStates bool) error {
@ -1503,11 +1497,6 @@ out:
// necessary items it needs to function. // necessary items it needs to function.
// //
// TODO(roasbeef): panic on below? // TODO(roasbeef): panic on below?
blockEpoch, err := p.server.cc.chainNotifier.RegisterBlockEpochNtfn()
if err != nil {
peerLog.Errorf("unable to register for block epoch: %v", err)
continue
}
_, currentHeight, err := p.server.cc.chainIO.GetBestBlock() _, currentHeight, err := p.server.cc.chainIO.GetBestBlock()
if err != nil { if err != nil {
peerLog.Errorf("unable to get best block: %v", err) peerLog.Errorf("unable to get best block: %v", err)
@ -1523,9 +1512,10 @@ out:
} }
// Create the link and add it to the switch. // Create the link and add it to the switch.
err = p.addLink(chanPoint, newChan, err = p.addLink(
&p.server.cc.routingPolicy, blockEpoch, chanPoint, newChan, &p.server.cc.routingPolicy,
chainEvents, currentHeight, false) chainEvents, currentHeight, false,
)
if err != nil { if err != nil {
peerLog.Errorf("can't register new channel "+ peerLog.Errorf("can't register new channel "+
"link(%v) with NodeKey(%x): %v", chanPoint, "link(%v) with NodeKey(%x): %v", chanPoint,