Bitcoin Forum
November 06, 2024, 05:23:13 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: create corrupted database / block  (Read 102 times)
22bits (OP)
Member
**
Offline Offline

Activity: 85
Merit: 25


View Profile
May 19, 2024, 05:13:30 AM
 #1

I previously had a slight issue where my computer died and it corrupted the block so I reran bitcoind with the -reindex option to correct the block issue.  I was looking into on startup detecting whether or not the chain / db is corrupted and was hoping to create the condition of the database being corrupted.  I have tried to create a condition where the db is corrupted, but just stopping power does not seem to work (must be power outage at particular spot in the chain maintenance).  Is there some reliable way to create a corrupted db to use for testing?  (on linux: ubuntu direct connect)
22bits (OP)
Member
**
Offline Offline

Activity: 85
Merit: 25


View Profile
May 19, 2024, 06:04:27 AM
 #2

Just a follow on:  I just started renaming blocks in blocks, chainstate and received the startup error:
Code:
2024-05-19T05:46:48Z Initializing chainstate Chainstate [ibd] @ height -1 (null)
2024-05-19T05:46:48Z Opening LevelDB in /home/xxxx3/.bitcoin/chainstate
2024-05-19T05:46:48Z Fatal LevelDB error: Corruption: 3 missing files; e.g.: /home/xxxx3/.bitcoin/chainstate/123425.ldb
2024-05-19T05:46:48Z You can use -debug=leveldb to get more complete diagnostic messages
2024-05-19T05:46:48Z Fatal LevelDB error: Corruption: 3 missing files; e.g.: /home/xxxx3/.bitcoin/chainstate/123425.ldb
2024-05-19T05:46:48Z : Error opening block database.
So if you want to create a corruption in db for testing, this works Smiley
Mia Chloe
Hero Member
*****
Offline Offline

Activity: 518
Merit: 670


Mia's Creative


View Profile
May 19, 2024, 07:00:31 AM
 #3

Firstly Op if I may ask , why are you trying to corrupt the drive? Probably it may exist, but I haven't really come across a drive corruption after the device have been successfully synced with the block chain. Majority of the cases I have come across especially on this forum are those where the drive got corrupt during the process of syncing with the block chain. Sometimes as a result of power outage and sometimes because the block chain was synced to a drive with the wrong format like FAT32 which sometimes has issues when the file load is huge.

RAM also has a huge role to play when it comes to computation during the syncronisation process which will attribute how long it will take before the sync is completed.

██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
██████████████████████████
 
 EVO.io 
 
BRIDGING THE GAP
BETWEEN CRYPTO
AND PLAY 
█████████████████████████
█████████████████████████
████████▀▀░░█░░▀▀████████
██████▀▄░░▄▄█▄▄░░▄▀██████
█████░░░█▀▄▄▄▄▄▀█░░░█████
████░░░██████████░░░████
████▀▀▀███████████▄▄▄████
████░░░██████████░░░████
█████░░░█▄▀▀▀▀▀▄█░░░█████
██████▄▀░░▀▀█▀▀░░▀▄██████
████████▄▄░░█░░▄▄████████
█████████████████████████
█████████████████████████

██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
 
ROULETTE
SLOTS
GAME SHOWS
MANY MORE
 
......DEPOSIT BONUS......
 
UP
TO
1 BTC + 150 
FREE
SPINS
████████████▄▄▀▀█
░▄▄▄██████████
██▀▄░▄▄▄███▄███
██▄▀███████
█▀▀████████████
░█████████████████
██████████████████
███████▄▄████▀████
█▄▄██▄█▀▀███▀█████
░█▀██▀▀▀▀███████
▀█▀██▀████████████
██▀█▀▀▀█▀█▀█████████
██▄▄▀▄▄▄█▄▄██████████▄
 
..Play Now..
22bits (OP)
Member
**
Offline Offline

Activity: 85
Merit: 25


View Profile
May 19, 2024, 07:06:08 AM
 #4

Thanks for asking.  Basically the other day when initially loading the blockchain there was a sudden power outage.  When the system came back up the bitcoind errored out.  Eventually my plan is to have a script which checks if the blockchain (local data stored on my system) is intact (this will run as a ExecStartPre in systemd), and then if not have a systemd process which will in those cases run the bitcoind with the -reindex option.  I already have a simple script which checks if the bitcoind is unable to start and will then hook it up to systemd process which runs with the -reindex in those cases.  
NotATether
Legendary
*
Offline Offline

Activity: 1778
Merit: 7362


Top Crypto Casino


View Profile WWW
May 19, 2024, 07:31:06 AM
Merited by ABCbits (2), vapourminer (1)
 #5

You shouldn't try to simulate a power outage as that can actually damage your motherboard. What would be better for testing purposes would be to force-kill the bitcoind process -  either by Task Manager or by sending SIGKILL (not sigterm) to it on Linux or Max.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
ABCbits
Legendary
*
Offline Offline

Activity: 3052
Merit: 8062


Crypto Swap Exchange


View Profile
May 20, 2024, 10:10:16 AM
 #6

Is there some reliable way to create a corrupted db to use for testing?  (on linux: ubuntu direct connect)

Bitcoin Core check recent block when you open it. So you probably just need to edit recently created blk*dat or rev*dat files to achieve that goal. I said probably since i didn't try it on my own Bitcoin Core files.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!