chaintnfs/neutrinonotify: add additional logging

This commit is contained in:
Olaoluwa Osuntokun 2017-05-24 17:26:45 -07:00
parent 0050108391
commit 392a8180dd
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -264,8 +264,9 @@ func (n *NeutrinoNotifier) notificationDispatcher() {
case *confirmationsNotification: case *confirmationsNotification:
chainntnfs.Log.Infof("New confirmations "+ chainntnfs.Log.Infof("New confirmations "+
"subscription: txid=%v, numconfs=%v", "subscription: txid=%v, numconfs=%v, "+
*msg.txid, msg.numConfirmations) "height_hint=%v", *msg.txid,
msg.numConfirmations, msg.heightHint)
// If the notification can be partially or // If the notification can be partially or
// fully dispatched, then we can skip the first // fully dispatched, then we can skip the first
@ -396,6 +397,9 @@ func (n *NeutrinoNotifier) attemptHistoricalDispatch(msg *confirmationsNotificat
scanHeight uint32 scanHeight uint32
) )
chainntnfs.Log.Infof("Attempting to trigger dispatch for %v from "+
"historical chain", msg.txid)
// Starting from the height hint, we'll walk forwards in the chain to // Starting from the height hint, we'll walk forwards in the chain to
// see if this transaction has already been confirmed. // see if this transaction has already been confirmed.
chainScan: chainScan:
@ -405,7 +409,7 @@ chainScan:
header, err := n.p2pNode.GetBlockByHeight(scanHeight) header, err := n.p2pNode.GetBlockByHeight(scanHeight)
if err != nil { if err != nil {
chainntnfs.Log.Errorf("unable to get header for "+ chainntnfs.Log.Errorf("unable to get header for "+
"height: %v", err) "height=%v: %v", scanHeight, err)
return false return false
} }
blockHash := header.BlockHash() blockHash := header.BlockHash()
@ -415,7 +419,7 @@ chainScan:
extFilter, err := n.p2pNode.GetExtFilter(blockHash) extFilter, err := n.p2pNode.GetExtFilter(blockHash)
if err != nil { if err != nil {
chainntnfs.Log.Errorf("unable to retrieve extended "+ chainntnfs.Log.Errorf("unable to retrieve extended "+
"filter for height: %v", scanHeight) "filter for height=%v: %v", scanHeight, err)
return false return false
} }
@ -634,6 +638,9 @@ func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
currentHeight := n.bestHeight currentHeight := n.bestHeight
n.heightMtx.RUnlock() n.heightMtx.RUnlock()
chainntnfs.Log.Infof("New spend notification for outpoint=%v, "+
"height_hint=%v", outpoint, heightHint)
ntfn := &spendNotification{ ntfn := &spendNotification{
targetOutpoint: outpoint, targetOutpoint: outpoint,
spendChan: make(chan *chainntnfs.SpendDetail, 1), spendChan: make(chan *chainntnfs.SpendDetail, 1),
@ -660,9 +667,6 @@ func (n *NeutrinoNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
neutrino.StartBlock(&waddrmgr.BlockStamp{ neutrino.StartBlock(&waddrmgr.BlockStamp{
Height: int32(heightHint), Height: int32(heightHint),
}), }),
neutrino.EndBlock(&waddrmgr.BlockStamp{
Height: int32(currentHeight),
}),
) )
if err != nil { if err != nil {
return nil, err return nil, err