mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-21 14:10:35 +02:00
Merge pull request #1007 from wpaulino/htlc-switch-stats
htlcswitch: fix periodic calculation of satoshis sent/received
This commit is contained in:
@@ -1402,11 +1402,22 @@ func (s *Switch) htlcForwarder() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the diff of num updates is negative, then some
|
||||||
|
// links may have been unregistered from the switch, so
|
||||||
|
// we'll update our stats to only include our registered
|
||||||
|
// links.
|
||||||
|
if int64(diffNumUpdates) < 0 {
|
||||||
|
totalNumUpdates = newNumUpdates
|
||||||
|
totalSatSent = newSatSent
|
||||||
|
totalSatRecv = newSatRecv
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Otherwise, we'll log this diff, then accumulate the
|
// Otherwise, we'll log this diff, then accumulate the
|
||||||
// new stats into the running total.
|
// new stats into the running total.
|
||||||
log.Infof("Sent %v satoshis received %v satoshis "+
|
log.Infof("Sent %d satoshis and received %d satoshis "+
|
||||||
"in the last 10 seconds (%v tx/sec)",
|
"in the last 10 seconds (%f tx/sec)",
|
||||||
int64(diffSatSent), int64(diffSatRecv),
|
diffSatSent, diffSatRecv,
|
||||||
float64(diffNumUpdates)/10)
|
float64(diffNumUpdates)/10)
|
||||||
|
|
||||||
totalNumUpdates += diffNumUpdates
|
totalNumUpdates += diffNumUpdates
|
||||||
|
Reference in New Issue
Block a user