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

ledger_hash discrepancy with identical credits and debits #2823

Open
adamkrellenstein opened this issue Dec 10, 2024 · 2 comments
Open

ledger_hash discrepancy with identical credits and debits #2823

adamkrellenstein opened this issue Dec 10, 2024 · 2 comments

Comments

@adamkrellenstein
Copy link
Member

No description provided.

@adamkrellenstein
Copy link
Member Author

adamkrellenstein commented Dec 12, 2024

this looks very much like a bug in how the ledger_hash is calculated... but it's a subtle one :/

@vectorconfetti
Copy link

hey, i have this crash repeatedly on my node. Happy to help debug further.
I upgraded from the version right before 10.8 (i think 10.7.4) to 10.8 as follows:

COUNTERPARTY_DOCKER_DATA=/home/vectorconfetti/storage docker compose --profile mainnet stop
git pull
COUNTERPARTY_DOCKER_DATA=/home/vectorconfetti/storage docker compose --profile mainnet up -d

Here's the crash:

counterparty-core-1  | 2024-12-16T19:50:16.307+00:00 - [   ERROR] - Ledger.Main - Exception caught!
counterparty-core-1  | Traceback (most recent call last):
counterparty-core-1  |   File "/usr/local/lib/python3.10/dist-packages/counterpartycore/server.py", line 804, in start_all
counterparty-core-1  |     blocks.catch_up(db)
counterparty-core-1  |   File "/usr/local/lib/python3.10/dist-packages/counterpartycore/lib/blocks.py", line 1465, in catch_up
counterparty-core-1  |     tx_index, parsed_block_index = parse_new_block(db, decoded_block, tx_index=tx_index)
counterparty-core-1  |   File "/usr/local/lib/python3.10/dist-packages/counterpartycore/lib/blocks.py", line 1335, in parse_new_block
counterparty-core-1  |     new_ledger_hash, new_txlist_hash, new_messages_hash = parse_block(
counterparty-core-1  |   File "/usr/local/lib/python3.10/dist-packages/counterpartycore/lib/blocks.py", line 383, in parse_block
counterparty-core-1  |     new_ledger_hash, found_ledger_hash = check.consensus_hash(
counterparty-core-1  |   File "/usr/local/lib/python3.10/dist-packages/counterpartycore/lib/check.py", line 942, in consensus_hash
counterparty-core-1  |     raise ConsensusError(error_message)
counterparty-core-1  | counterpartycore.lib.check.ConsensusError: Incorrect ledger_hash hash for block 871781.  Calculated 48cbad49ef18eaff985b6db973912520c1eaace235116b6e7e43fb014e74d711 but expected f214d9ed443e0034e1d3508f016086a841fb89036baae1aae857d273ef2a0b76
counterparty-core-1  | 2024-12-16T19:50:16.311+00:00 - [    INFO] - Ledger.Main - Stopping API v1 Status Poller thread...

When I tried to run the rollback command (as below, wild guess on if it's right or not with Docker)

vectorconfetti@vectorconfetti:~/counterparty-core$ COUNTERPARTY_DOCKER_DATA=/home/vectorconfetti/storage docker run counterparty/counterparty:v10.8.0 rollback 871780

Counterparty Core v10.8.0
Verbosity: 0
Quiet: False
Network: mainnet
Configuration File: /root/.config/counterparty/server.conf
Counterparty Database: /root/.local/share/counterparty/counterparty.db
Counterparty State Database: /root/.local/share/counterparty/state.db
Rust Fetcher Database: /root/.cache/counterparty/fetcherdb
Server Log: /root/.cache/counterparty/log/server.log
API Access Log: /root/.cache/counterparty/log/server.access.log

------------------------------ ROLLBACK ------------------------------

Unhandled Exception
Traceback (most recent call last):
  File "/usr/local/bin/counterparty-server", line 8, in <module>
    sys.exit(cli.main())
  File "/usr/local/lib/python3.10/dist-packages/counterpartycore/cli.py", line 513, in main
    server.rollback(block_index=args.block_index)
  File "/usr/local/lib/python3.10/dist-packages/counterpartycore/server.py", line 879, in rollback
    last_block = ledger.get_last_block(ledger_db)
  File "/usr/local/lib/python3.10/dist-packages/counterpartycore/lib/ledger.py", line 1252, in get_last_block
    cursor.execute(query, (config.MEMPOOL_BLOCK_INDEX,))
  File "src/cursor.c", line 959, in APSWCursor_execute.sqlite3_prepare_v3
apsw.SQLError: SQLError: no such table: blocks
vectorconfetti@vectorconfetti:~/counterparty-core$ COUNTERPARTY_DOCKER_DATA=/home/vectorconfetti/storage docker run counterparty/counterparty:v10.8.0 rollback 871780

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants