Re-reading a Block from Blockchain
⚠️ For advanced users only. All actions are performed at your own risk. Incorrect changes to the database may result in loss or duplication of transactions. Make sure you understand each step before proceeding.
Problem
Due to block reorganization in the Ethereum network, a transaction that is confirmed on the blockchain may be missing from the system. This happens when processing has handled a block from a temporary (discarded) chain branch and skipped the corresponding block from the main chain. To restore the correct state, you need to manually trigger re-reading of the required block.
Solution
1. Create a database backup
sudo -u postgres pg_dump dv-processing > /tmp/dv-processing_backup_$(date +%Y%m%d_%H%M%S).sqlVerify that the file was created and is not empty:
ls -lh /tmp/dv-processing_backup_*.sql2. (!IMPORTANT — in a separate terminal) Stop processing
sudo systemctl stop dv-processing3. (in the main terminal) Switch to the database user
sudo su
sudo su - postgres4. (in the main terminal) Start psql
psqlor
/home/dv/embedded/usr/local/pgsql/bin/psql -p 54335. (in the main terminal) Connect to the dv-processing database
\c dv-processing6. (in the main terminal) Read the current parsing state
select number from processed_blocks where blockchain = 'bsc';!IMPORTANT — remember the result:
number ---------- 81923203 (1 row)
7. (in the main terminal) Update the value to block -1 of your transaction
Example for transaction 0xffe238ba2c1e028a8ec1c467cef53fa59112e2ccc922dc64345817f9da0f4e71 — block 81921203:
update processed_blocks set number = 81921203 where blockchain = 'bsc';8. (!IMPORTANT — in a separate terminal) Start processing
sudo systemctl start dv-processing9. (in the main terminal) After a couple of minutes, verify that blocks have advanced
The value should have increased by several tens or hundreds from 81921203 — this indicates successful block re-reading.
select number from processed_blocks where blockchain = 'bsc';10. (!IMPORTANT — in a separate terminal) Stop processing
sudo systemctl stop dv-processing11. (in the main terminal) Restore the block value to what you noted in step 6
update processed_blocks set number = 81923203 where blockchain = 'bsc';12. (!IMPORTANT — in a separate terminal) Start processing
sudo systemctl start dv-processingAfter this, the transaction will most likely be picked up.