U-Network / UNetwork

U Network Public Blockchain
https://u.network/
Apache License 2.0
188 stars 22 forks source link

wallet.dat file is vulnerable if client crashes #30

Closed fmlwlher closed 6 years ago

fmlwlher commented 6 years ago

wallet.dat file is vulnerable if client crashes. #29

For now each time a new block is produced the wallet.dat file is updated. However, this design is vulnerable in the case when the client crashes the private key stored in the wallet file may be lost. There are two solutions to this issue:

decouple wallet.dat from blockchain read/write. backup wallet file each time a new block is produced.

fmlwlher commented 6 years ago

@yilugit @Clairvoyant1236

0xyilu commented 6 years ago

+1

0xyilu commented 6 years ago

@Clairvoyant1236 any feedback?

Clairvoyant1236 commented 6 years ago

@yilugit Code looks good to me. I'm simulating crashes to see if the backup file stores the original wallet file correctly. Will merge it once I'm done with testing tomorrow.

0xyilu commented 6 years ago

pay attention to the commit msg next time @fmlwlher