btcgreen-blockchain
btcgreen-blockchain copied to clipboard
[BUG] v2 DB is not used
I'm trying to convert v1 DB to v2 DB using btcgreen db upgrade
. It seems to work, but an attempt to validate the resulting v2 DB ends with an error:
$ btcgreen db validate
opening file for reading: /home/pi/.btcgreen/mainnet/db/blockchain_v2_mainnet.sqlite
peak hash: d716e4847d7f2fe044702a6995813ea0a897624ac730be86cc4e64734e8bf400
peak height: 1038793
traversing the full chain
0 orphaned blocks: 0
FAILED: Blockchain has invalid genesis challenge b'6Q\x04\x0b\x10\xc4\x17Q.\xe2Q\xd6NVl\xf7/B\xc9}\x14\xf7\xe0n\xb1\x18\x93\xeb\x14Gw*', expected a41b40c6fbb8941cfa3bd8f1c85ebdeabfd0872c321bb5c1128581d127861585
Even though the upgrade process changed config.yaml to database_path: db/blockchain_v2_CHALLENGE.sqlite
, it seems that only the v1 DB is actually used:
ls -l /home/pi/.btcgreen/mainnet/db/
total 17142028
-rw-r--r-- 1 pi pi 9587064832 Mar 20 20:16 blockchain_v1_mainnet.sqlite
-rw-r--r-- 1 pi pi 65536 Mar 20 20:16 blockchain_v1_mainnet.sqlite-shm
-rw-r--r-- 1 pi pi 20983192 Mar 20 20:23 blockchain_v1_mainnet.sqlite-wal
-rw-r--r-- 1 pi pi 7908290560 Mar 20 18:05 blockchain_v2_mainnet.sqlite
If I restart btcgreen with database_path: db/blockchain_v2_CHALLENGE.sqlite
, it seems the blockchain_v2_mainnet.sqlite
file is updated, but in fact the v1 format is still used. Because if I try:
$ btcgreen db validate
opening file for reading: /home/pi/.btcgreen/mainnet/db/blockchain_v2_mainnet.sqlite
FAILED: Database is missing version table
The same happens for btcgreen 1.3.0 and 1.3.1,