chainntnfs/btcd+neutrino: close spendChan after send

This commit is contained in:
Conner Fromknecht 2017-08-03 00:18:33 -07:00 committed by Olaoluwa Osuntokun
parent 0d4ee08372
commit d1e797451d
2 changed files with 10 additions and 1 deletions

View File

@ -398,8 +398,12 @@ out:
"spend notification for "+
"outpoint=%v", ntfn.targetOutpoint)
ntfn.spendChan <- spendDetails
}
// Close spendChan to ensure that any calls to Cancel will not
// block. This is safe to do since the channel is buffered, and the
// message can still be read by the receiver.
close(ntfn.spendChan)
}
delete(b.spendNotifications, prevOut)
}
}

View File

@ -398,6 +398,11 @@ func (n *NeutrinoNotifier) notificationDispatcher() {
"spend notification for "+
"outpoint=%v", ntfn.targetOutpoint)
ntfn.spendChan <- spendDetails
// Close spendChan to ensure that any calls to Cancel will not
// block. This is safe to do since the channel is buffered, and the
// message can still be read by the receiver.
close(ntfn.spendChan)
}
delete(n.spendNotifications, prevOut)