chainntnfs/btcdnotify: add additional logic when dispatching ntfns

This commit is contained in:
Olaoluwa Osuntokun 2017-12-07 19:09:45 -08:00
parent 36c299c1d8
commit 839ce0689e
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
1 changed files with 4 additions and 2 deletions

View File

@ -445,6 +445,8 @@ func (b *BtcdNotifier) attemptHistoricalDispatch(
// dispatch it immediately after obtaining for information w.r.t
// exactly *when* if got all its confirmations.
if uint32(tx.Confirmations) >= msg.numConfirmations {
chainntnfs.Log.Infof("Dispatching %v conf notification",
msg.numConfirmations)
msg.finConf <- confDetails
return true
}
@ -513,8 +515,8 @@ func (b *BtcdNotifier) notifyConfs(newBlockHeight int32) {
// is eligible until there are no more eligible entries.
nextConf := heap.Pop(b.confHeap).(*confEntry)
for nextConf.triggerHeight <= uint32(newBlockHeight) {
// TODO(roasbeef): shake out possible of by one in height calc
// for historical dispatches
chainntnfs.Log.Infof("Dispatching %v conf notification, "+
"height=%v", nextConf.numConfirmations, newBlockHeight)
nextConf.finConf <- nextConf.initialConfDetails
if b.confHeap.Len() == 0 {