From d18fe97088c985eff15649bdbd9a4b14e75ddf45 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Wed, 12 Sep 2018 12:04:32 +0200 Subject: [PATCH] feat(sync): more granular sync progress info --- app/lib/lnd/neutrino.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/lib/lnd/neutrino.js b/app/lib/lnd/neutrino.js index 23914b07..dd2c55f3 100644 --- a/app/lib/lnd/neutrino.js +++ b/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) + } } }