chainntnfs: fix RegisterSpend and RegisterConf height hint logs

This commit is contained in:
Wilmer Paulino 2019-03-19 18:37:28 -07:00
parent 1a8e4b0316
commit bde417e2ef
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -517,7 +517,8 @@ func (n *TxNotifier) RegisterConf(ntfn *ConfNtfn) (*HistoricalConfDispatch,
if err == nil {
if hint > startHeight {
Log.Debugf("Using height hint %d retrieved from cache "+
"for %v", hint, ntfn.ConfRequest)
"for %v instead of %d", hint, ntfn.ConfRequest,
startHeight)
startHeight = hint
}
} else if err != ErrConfirmHintNotFound {
@ -528,6 +529,9 @@ func (n *TxNotifier) RegisterConf(ntfn *ConfNtfn) (*HistoricalConfDispatch,
n.Lock()
defer n.Unlock()
Log.Infof("New confirmation subscription: conf_id=%d, %v, "+
"height_hint=%d", ntfn.ConfID, ntfn.ConfRequest, startHeight)
confSet, ok := n.confNotifications[ntfn.ConfRequest]
if !ok {
// If this is the first registration for this request, construct
@ -840,7 +844,8 @@ func (n *TxNotifier) RegisterSpend(ntfn *SpendNtfn) (*HistoricalSpendDispatch,
if err == nil {
if hint > startHeight {
Log.Debugf("Using height hint %d retrieved from cache "+
"for %v", startHeight, ntfn.SpendRequest)
"for %v instead of %d", hint, ntfn.SpendRequest,
startHeight)
startHeight = hint
}
} else if err != ErrSpendHintNotFound {
@ -852,7 +857,7 @@ func (n *TxNotifier) RegisterSpend(ntfn *SpendNtfn) (*HistoricalSpendDispatch,
defer n.Unlock()
Log.Infof("New spend subscription: spend_id=%d, %v, height_hint=%d",
ntfn.SpendID, ntfn.SpendRequest, ntfn.HeightHint)
ntfn.SpendID, ntfn.SpendRequest, startHeight)
// Keep track of the notification request so that we can properly
// dispatch a spend notification later on.