zcash / zcash

Zcash - Internet Money

Home Page:https://z.cash/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UX: Full node rescans upon every start

khazaddum opened this issue · comments

What were you trying to do

Shutdown zcashd and then restart the node.

What happened

zcashd starts a full re-scan even if the node was shutdown only for a few moments.

Hi @khazaddum,
actually when node instance starts two things happen:

  1. The full index of blocks is loaded into memory
  2. The latest n blocks are re-verified

Wrt point 1 this is not something the code can skip as a full view of the chain must be loaded. This implies more than handful of seconds to complete on behalf of your storage capabilities.

Point 2 instead is controlled by two command line arguments:

  -checkblocks=<n>
       How many blocks to check at startup (default: 288, 0 = all)

  -checklevel=<n>
       How thorough the block verification of -checkblocks is (0-4, default: 3)

Which means by default zend rechecks most recent 288 blocks at level 3
If you want to shave few seconds from the bootstrap process you might want to add -checklevel=0 to the command line arguments you set to launch zcashd.

Warning ... do not use -checkblocks=0 as this will revalidate the whole history of blocks (as stated in the help).
Hope this helps.

The issue I'm facing is not related the normal loading of block index and the catchup the node does upon start.

The node starts up as if I had used -rescan even though I didn't. The node takes 3+ days to re-scan the chain.

This means that an application that relies on a full node for interactions with the Zcash blockchain would have a days-long outage if the node is shutdown for any reason.

3 days it seems to me a bit odd.
Honestly on my local PC it takes roughly less than 30 seconds to be "ready" after a shutdown and restart.

Is it possible for you to share the startup command line and specs about your host ?
Thank you.

Eventually a copy of the initial longlines (first minute or so) would help diagnose the problem
3 days would be the time to fully resync from scratch.

I am just issuing zcashd from a terminal.

My config:

server=1
experimentalfeatures=1
txindex=1
insight-explorer=1

Screenshot_20231107_141116

So it's possible you're not running the latest release.
What do you see on your terminal if you launch this command ?

$ ./zcashd -version

Here what I see on my local version. (Note is 5.7.0

Zcash Daemon version v5.7.0-883fa686a

In order to ensure you are adequately protecting your privacy when using Zcash,
please see <https://z.cash/support/security/>.

Copyright (C) 2009-2023 The Bitcoin Core Developers
Copyright (C) 2015-2023 The Zcash Developers

This is experimental software.

Distributed under the MIT software license, see the accompanying file COPYING
or <https://www.opensource.org/licenses/mit-license.php>.

Hey @khazaddum,
have you managed to solve the issue ?
If you're ok now maybe would be useful to close the issue.
Otherwise I'd be happy to help further.

The issue is not resolved, and others are reporting similar issues on the forum. The node starts a rescan even when you don't use -rescan on the CLI.

Thank you for the update.
I wish you could share the current version you're actually on to begin with.

{
  "version": 5070050,
  "build": "v5.7.0",
  "subversion": "/MagicBean:5.7.0/",
  "protocolversion": 170100,
  "walletversion": 60000,
  "balance": 0.00000000,
  "blocks": 2295653,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": 49696469.10095143,
  "testnet": false,
  "keypoololdest": 1650463293,
  "keypoolsize": 101,
  "paytxfee": 0.00000000,
  "relayfee": 0.00000100,
  "errors": "",
  "errorstimestamp": 1699892786
}

Tested again today, still doing the same thing. The node reports "Verifying wallet..." then starts a full re-scan, so it's now down for days.

Yes, I also seem to have this issue on the latest version. It tooks days to synchronize, than I started lightwalletd, and now it's taking FOREVER and a half, even after the reindexing phase which i thought was the last phase, which btw I didn't know if it gets interrupted would have to start over .. I mean this is turning into a two weeks process and my clients are getting impatient, what it going here and how do I solve this? Appears to be doing this right now: https://bitcoin.stackexchange.com/questions/28173/what-does-updatetip-mean , and taking forever.

I have this issue with one particular zcashd instance and my theory is that it's because this node has an few old pre-HD-wallet addresses in it.

Other nodes I have that only have HD wallet addresses don't rescan the chain upon restart.

I have this issue with one particular zcashd instance and my theory is that it's because this node has an few old pre-HD-wallet addresses in it.

Other nodes I have that only have HD wallet addresses don't rescan the chain upon restart.

Well, what do I do about it? And if I stop this process now to change some settings, will it have to completely go through this again? The reindexing finished, but now it's running through this process almost like it has to sync all over again, and i don't know what to do ..

So, it took about ten days, but it did eventually synchronize. There is a bug in this release that causes the output to incorrectly report the status percentage. I checked the debug log and saw that it was in fact synced. Then I had to reindex, which took about 5 days.

As the admin of about a dozen various blockchain nodes, think that I can say with some credibility that zcashd has the slowest sync process of all the blockchains in the universe.