CounterpartyXCP / counterparty-core

Counterparty Protocol Reference Implementation
http://counterparty.io
MIT License
287 stars 206 forks source link

Blockchain reorganisation at block 328198. Another instance is already running, quitting. #385

Closed ghost closed 10 years ago

ghost commented 10 years ago

I can't say I was doing anything in particular... I had Bitcoin-qt and counterpartyd server running and counterpartyd suddenly stopped with the following error (also upon restart, as you can see below):

C:\Windows\System32>counterpartyd server
C:\Windows\System32>echo off
Status: Connecting to database.
Status: Running v9.45.0 of counterpartyd.
Status: Checking version.
Status: Connecting to block explorer.
Status: Connecting to backend.
Status: Resuming parsing.
Status: Blockchain reorganisation at block 328198.
Another instance is already running, quitting.
Another instance is already running, quitting.
C:\Windows\System32>

I think I may be running develop branch v.9.45.0.

adamkrellenstein commented 10 years ago

Ah. I know what commit introduced that bug and exactly how to fix it. Will do when I'm back at my computer.

adamkrellenstein commented 10 years ago

Fixed: f78b636720ed99461326357430e61db202011081

ghost commented 10 years ago

ACK

C:\Windows\system32>counterpartyd server

C:\Windows\system32>echo off
Status: Connecting to database.
Status: Running v9.45.0 of counterpartyd.
Status: Checking version.
Status: Connecting to block explorer.
Status: Connecting to backend.
Status: Resuming parsing.
Status: Blockchain reorganisation at block 328198.
Status: Reparsing all transactions.
ghost commented 10 years ago

Ooops. I just got the two files and that either isn't the way it's supposed to work or maybe there's another problem.

Traceback (most recent call last):
  File "C:\counterpartyd_build\dist\counterpartyd\counterpartyd.py", line 1120,
in <module>
    blocks.follow(db)
  File "C:\counterpartyd_build\dist\counterpartyd\lib\blocks.py", line 1341, in
follow
    reparse(db, block_index=c-1, quiet=True)
  File "C:\counterpartyd_build\dist\counterpartyd\lib\blocks.py", line 1196, in
reparse
    previous_txlist_hash, block['txlist_hash'])
  File "C:\counterpartyd_build\dist\counterpartyd\lib\blocks.py", line 176, in p
arse_block
    ledger_hash = generate_ledger_hash(db, block_index, previous_ledger_hash, cu
rrent_ledger_hash)
  File "C:\counterpartyd_build\dist\counterpartyd\lib\blocks.py", line 147, in g
enerate_ledger_hash
    ledger_hash = generate_consensus_hash(db, block_index, 'ledger_hash', util.B
LOCK_LEDGER, 0, previous_hash, current_hash)
  File "C:\counterpartyd_build\dist\counterpartyd\lib\blocks.py", line 137, in g
enerate_consensus_hash
    raise exceptions.ConsensusError('Incorrect {} for block {}.'.format(field, b
lock_index))
lib.exceptions.ConsensusError: Incorrect ledger_hash for block 326735.

My blocks.py (dowloaded from your commit) has the relocated line from from that change in #382 but that doesn't seem to be enough.

adamkrellenstein commented 10 years ago

@rippler, can/did you run a manual reparse?

ghost commented 10 years ago

No I haven't because the log said counterpartyd was doing it, but I'll give it a try. A min ago I started counterpartyd again so I'll wait until it exits with the same error and then I'll try.

ouziel-slama commented 10 years ago

@rippler, if persist after reparse try ./counterpartyd.py rollback 326734

ghost commented 10 years ago

Manual reparse failed the same way, doing rollback... Wow... compared to last spring, this stuff takes time now.

C:\>counterpartyd rollback 326734
...
Block (re‐parse): 326733
Block (re‐parse): 326734
Status: Database minor version number updated.

C:\Windows\system32>counterpartyd server
C:\Windows\system32>echo off
Status: Connecting to database.
Status: Running v9.45.0 of counterpartyd.
Status: Checking version.
Status: Connecting to block explorer.
Status: Connecting to backend.
Status: Resuming parsing.
Expired order: 01bbcf6ff72409c6173be1cf911ad79334dc77267d4d86cc2933596eed432b1c
...

OK