From c3c8b0015d438c422fd18a419b729856b589bca1 Mon Sep 17 00:00:00 2001 From: brusher_ru Date: Mon, 14 Oct 2024 18:55:43 -0300 Subject: [PATCH] feat: add support of incremental quicksync --- desktop/NodeManager.ts | 24 +++++++++++++++++------- node/use-version-quicksync | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/desktop/NodeManager.ts b/desktop/NodeManager.ts index 69f0e9ca4..3873b2c4a 100644 --- a/desktop/NodeManager.ts +++ b/desktop/NodeManager.ts @@ -778,6 +778,9 @@ class NodeManager extends AbstractManager { }; }; + private getNodeStateFile = (nodeData: string) => + path.resolve(nodeData, 'state.sql'); + private checkForPausedQuicksync = async ( nodeData: string ): Promise => { @@ -912,13 +915,20 @@ class NodeManager extends AbstractManager { } const bin = getQuicksyncPath(); - const args = [ - 'download', - '--node-data', - this.getNodeDataPath(), - '--go-spacemesh-path', - getNodePath(), - ]; + + const nodeDataPath = this.getNodeDataPath(); + const stateFile = this.getNodeStateFile(nodeDataPath); + const shouldDownloadEntire = !(await fse.pathExists(stateFile)); + + const args = shouldDownloadEntire + ? [ + 'download', + '--node-data', + nodeDataPath, + '--go-spacemesh-path', + getNodePath(), + ] + : ['partial', '-s', stateFile, '-j', '1']; logger.log('runQuicksync:download', `${bin} ${args.join(' ')}`); diff --git a/node/use-version-quicksync b/node/use-version-quicksync index 00a2c6f10..42cd91d18 100644 --- a/node/use-version-quicksync +++ b/node/use-version-quicksync @@ -1 +1 @@ -v0.1.16 +v0.2.0-alpha