chainntnfs: Fix stylistic issues.

This commit is contained in:
Jim Posen 2017-12-10 10:34:49 -08:00 committed by Olaoluwa Osuntokun
parent 280e264e8c
commit bc7c834362
2 changed files with 40 additions and 31 deletions

View File

@ -300,6 +300,7 @@ out:
chainntnfs.Log.Warnf("Received blocks out of order: "+
"current height=%d, new height=%d",
currentHeight, update.blockHeight)
continue
}
currentHeight = update.blockHeight
@ -321,22 +322,24 @@ out:
if err != nil {
chainntnfs.Log.Error(err)
}
} else {
if update.blockHeight != currentHeight {
chainntnfs.Log.Warnf("Received blocks out of order: "+
"current height=%d, disconnected height=%d",
currentHeight, update.blockHeight)
}
continue
}
currentHeight = update.blockHeight - 1
if update.blockHeight != currentHeight {
chainntnfs.Log.Warnf("Received blocks out of order: "+
"current height=%d, disconnected height=%d",
currentHeight, update.blockHeight)
continue
}
chainntnfs.Log.Infof("Block disconnected from main chain: "+
"height=%v, sha=%v", update.blockHeight, update.blockHash)
currentHeight = update.blockHeight - 1
err := b.txConfNotifier.DisconnectTip(uint32(update.blockHeight))
if err != nil {
chainntnfs.Log.Error(err)
}
chainntnfs.Log.Infof("Block disconnected from main chain: "+
"height=%v, sha=%v", update.blockHeight, update.blockHash)
err := b.txConfNotifier.DisconnectTip(uint32(update.blockHeight))
if err != nil {
chainntnfs.Log.Error(err)
}
case item := <-b.txUpdates.ChanOut():

View File

@ -334,6 +334,8 @@ func (n *NeutrinoNotifier) notificationDispatcher() {
chainntnfs.Log.Warnf("Received blocks out of order: "+
"current height=%d, new height=%d",
n.bestHeight, update.height)
n.heightMtx.Unlock()
continue
}
n.bestHeight = update.height
@ -346,25 +348,29 @@ func (n *NeutrinoNotifier) notificationDispatcher() {
if err != nil {
chainntnfs.Log.Error(err)
}
} else {
n.heightMtx.Lock()
if update.height != n.bestHeight {
chainntnfs.Log.Warnf("Received blocks out of order: "+
"current height=%d, disconnected height=%d",
n.bestHeight, update.height)
}
n.bestHeight = update.height - 1
n.heightMtx.Unlock()
chainntnfs.Log.Infof("Block disconnected from main chain: "+
"height=%v, sha=%v", update.height, update.hash)
err := n.txConfNotifier.DisconnectTip(update.height)
if err != nil {
chainntnfs.Log.Error(err)
}
continue
}
n.heightMtx.Lock()
if update.height != n.bestHeight {
chainntnfs.Log.Warnf("Received blocks out of order: "+
"current height=%d, disconnected height=%d",
n.bestHeight, update.height)
n.heightMtx.Unlock()
continue
}
n.bestHeight = update.height - 1
n.heightMtx.Unlock()
chainntnfs.Log.Infof("Block disconnected from main chain: "+
"height=%v, sha=%v", update.height, update.hash)
err := n.txConfNotifier.DisconnectTip(update.height)
if err != nil {
chainntnfs.Log.Error(err)
}
case err := <-n.rescanErr:
chainntnfs.Log.Errorf("Error during rescan: %v", err)