Browse Source

feat(sync): more granular sync progress info

renovate/lint-staged-8.x
Tom Kirkpatrick 6 years ago
parent
commit
d18fe97088
No known key found for this signature in database GPG Key ID: 72203A8EC5967EA8
  1. 11
      app/lib/lnd/neutrino.js

11
app/lib/lnd/neutrino.js

@ -187,6 +187,8 @@ class Neutrino extends EventEmitter {
height = match[1]
} else if ((match = line.match(/Processed \d* blocks? in the last.+\(height (\d+)/))) {
height = match[1]
} else if ((match = line.match(/Difficulty retarget at block height (\d+)/))) {
height = match[1]
} else if ((match = line.match(/Fetching set of headers from tip \(height=(\d+)/))) {
height = match[1]
} else if ((match = line.match(/Waiting for filter headers \(height=(\d+)\) to catch/))) {
@ -201,6 +203,8 @@ class Neutrino extends EventEmitter {
cfilter = match[1]
} else if ((match = line.match(/Verified \d* filter headers? in the.+\(height (\d+)/))) {
cfilter = match[1]
} else if ((match = line.match(/Fetching filter for height=(\d+)/))) {
cfilter = match[1]
}
if (height) {
@ -285,8 +289,11 @@ class Neutrino extends EventEmitter {
*/
setLndCfilterHeight(height: number | string) {
const heightAsNumber = Number(height)
this.lndCfilterHeight = heightAsNumber
this.emit(GOT_LND_CFILTER_HEIGHT, heightAsNumber)
const changed = Neutrino.incrementIfHigher(this, 'lndCfilterHeight', heightAsNumber)
if (changed) {
this.emit(GOT_LND_CFILTER_HEIGHT, heightAsNumber)
this.setCurrentBlockHeight(heightAsNumber)
}
}
}

Loading…
Cancel
Save