I am working on HA cluster at the moment:
1. two servers (master / slave) are connected and start with the same wallet.dat
2. master checks periodically if result of dumpwallet has changed
3. if true master sends dump to slave
4. slave does an "importwallet"
The problem here is that importwallet rescans the complete blockchain.
Rescanning all blocks seems to be quite slow and the multichain rpc is not responding in this period of time.
- 60GB blocks folder
- importwallet with one new privatekey runs since 2h and is still running
- machine is ec2 m5.xlarge
- rpc is not responsive
here is the debug.log output
2018-05-03 07:03:26 Skipping import of 1CNpcJb2xBQ15LgNQCKjFBYAZGXabMXXuHZTrh (key already present)
2018-05-03 07:03:26 Skipping import of 19uWPgKbkn4uGBuf3RQFgpUL71XWoghzAgnMJj (key already present)
2018-05-03 07:03:26 Importing 1TaY4J9DsfMBcbY8mTusciKJfnTgD5G1RD3x2c...
2018-05-03 07:03:26 Skipping import of 177Myj4T8aqYrJJ6ZrDP6md85GLzu7g9BYYRYm (key already present)
2018-05-03 07:03:26 Rescanning all 50954 blocks
2018-05-03 08:25:16 Still rescanning. At block 1. Progress=1.000000
2018-05-03 08:26:48 Still rescanning. At block 15. Progress=1.000000
2018-05-03 08:27:57 Still rescanning. At block 30. Progress=1.000000
2018-05-03 08:29:16 Still rescanning. At block 32. Progress=1.000000
2018-05-03 08:31:06 Still rescanning. At block 35. Progress=1.000000
First of all it took nearly 1,5h to actually start scanning. (?)
Then it seems like it needs 10 seconds to scan one single block. (Maybe this is ok since there are about 5000 transactions in a single block).
So it would take nearly a week to rescan all 55000 blocks.
My problem is that a cannot use importprivkey with rescan=false, since I do not know if this address has already been used. That's because I only sync the wallet periodically. I am also not able to intercept calls like "getnewaddress".
Maybe an option could be that there is a parameter for importwallet (and also importprivkey) that tells multichain how far in the past it should search for an address transaction.
e.g. if I do an hourly sync, only the last e.g. 500 blocks must be rescanned for the new address.
(I also have a timestamp information in the dumpwallet file itself)
importwallet dump.dat 500
to rescan the last 500 blocks for all new addresses
importprivkey ABC123 true 500
to rescan last 500 blocks for key ABC123
(but even this would still take over an hour)
But having a cluster with a HA node that takes about 6 days to catch up with a single address is quite bad.
Same holds true for backup and restore. If after a server crash I need to restore the blockchain, it seems to be reasonable to reindex / rescan the restored chain. But this also shouldn't take a week.
In general I am a little bit concerned to hopefully never be forced to do a reindex / rescan on a huge blockchain, since this would take several days to be operational again.
Do you have similar experiences?