Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testnet] genesis block doesn't accept during reindex #573

Open
DeckerSU opened this issue Mar 1, 2023 · 2 comments
Open

[testnet] genesis block doesn't accept during reindex #573

DeckerSU opened this issue Mar 1, 2023 · 2 comments

Comments

@DeckerSU
Copy link

DeckerSU commented Mar 1, 2023

Steps to reproduce:

  1. Compile komodod from latest dev branch, and launch it, for example, with the following params:
-ac_name=INDXFAIL --testnet

As you will see in debug.log, the genesis block will be accepted:

2023-03-01 17:25:14 Pre-allocating up to position 0x1000000 in blk00000.dat
2023-03-01 17:25:14 UpdateTip: new best=e46e999d6de5ef95427ea51b8242ef7949de22b340b6a484ff154b9991ec9452  height=0  log2_work=4.0874628  tx=1  date=2011-02-02 23:16:42 progress=1.000000  cache=0.0MiB(0tx)
2023-03-01 17:25:14 init message: Rewinding blocks if needed...
2023-03-01 17:25:14 init message: Verifying blocks...
  1. Change indexes in the ~/.komodo/INDXFAIL/INDXFAIL.conf to force reindex, for example, add the following lines into config:
addressindex=1
timestampindex=1
spentindex=1

As the previous indexes was only with txindex=1 it will trigger reindex:

2023-03-01 17:26:55 Reindexing block file blk00000.dat...
  1. And then you will see in debug.log:
2023-03-01 17:26:55 Waiting for genesis block to be imported...
2023-03-01 17:26:55 Reindexing block file blk00000.dat...
2023-03-01 17:26:55 ERROR: CheckBlock: proof of work failed
2023-03-01 17:26:55 InvalidChainFound: invalid block=e46e999d6de5ef95427ea51b8242ef7949de22b340b6a484ff154b9991ec9452  height=0  log2_work=4.0874628  date=2011-02-02 23:16:42

And in stdout:

set addressindex, will reindex. could take a while.
set spentindex, will reindex. could take a while.
finished loading blocks INDXFAIL
OS_loadfile null size.(/home/decker/.komodo/INDXFAIL/komodostate)
komodo_faststateinit retval.-1
fAddressIndex.1/0 fSpentIndex.1/0
nLocalServices 30000005 1, 1
e46e999d6de5ef95427ea51b8242ef7949de22b340b6a484ff154b9991ec9452 hash vs 0f0f0f0000000000000000000000000000000000000000000000000000000000 ht.1 special.0 special2.0 flag.0 notaryid.-1 mod.1 error
04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb6 <- pubkey
04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb6 <- origpubkey
e46e999d6de5ef95427ea51b8242ef7949de22b340b6a484ff154b9991ec9452 failed hash ht.0
komodod: main.cpp:2647: void InvalidChainFound(CBlockIndex*): Assertion `tip' failed.
@DeckerSU DeckerSU changed the title [testmet [testnet] genesis block doesn't accept during reindex Mar 1, 2023
@DeckerSU
Copy link
Author

DeckerSU commented Mar 1, 2023

It seems this happened because testnet genesis block selected by @jmjatlanta doesn't meet consensus.powLimit requirements, like:
e46e999d6de5ef95427ea51b8242ef7949de22b340b6a484ff154b9991ec9452 is bigger than
0f0f0f000000000000000000000000000000000000000000000000000000000 and inside CheckProofOfWork condition

if ( UintToArith256(hash = blkHeader.GetHash()) > bnTarget )
{
...
}

leads to fail. The solution is to re-create the testnet with new, acceptable genesis block.

@dimxy
Copy link
Collaborator

dimxy commented Mar 1, 2023

yes I suggest we can use the mainnet genesis for testnet (like it was originally)

who-biz pushed a commit to who-biz/komodo that referenced this issue Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants