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

bug: crash on wallet encrypt #5715

Open
PastaPastaPasta opened this issue Nov 16, 2023 · 3 comments
Open

bug: crash on wallet encrypt #5715

PastaPastaPasta opened this issue Nov 16, 2023 · 3 comments
Assignees

Comments

@PastaPastaPasta
Copy link
Member

Steps to reproduce

  1. Create a new wallet, call it 1000000 leave all checkboxes as default.
  2. In the console, swap to that wallet and issue keypoolrefill 1000000
  3. Here a bug emerges, I had to close numerous popups that claimed the refill progress, but I could see in the debug.log that the refill was already done.
  4. Exit the app.
  5. Start the app and switch to the wallet named 1000000
  6. Select encrypt and choose password of 1234
  7. This appears to hang, after a few seconds click anywhere on the window and the assert appears.

Stack trace

$ ./src/qt/dash-qt --testnet [±v20.x ●]
Assertion failure:
assertion: false
file: wallet.cpp, line: 661
function: EncryptWallet
0#: (0x105C0E004) stacktraces.cpp:629 - __assert_rtn
1#: (0x10505444C) wallet.cpp - ???
2#: (0x10495DA6C) askpassphrasedialog.cpp:149 - ???
3#: (0x1056B0D7C) slice.h - ???
4#: (0x105894618) slice.h - ???
5#: (0x1056B0D7C) slice.h - ???
6#: (0x1058188C0) slice.h - ???
7#: (0x1058184F4) slice.h - ???
8#: (0x1058DE910) slice.h - ???
9#: (0x10579BE30) slice.h - ???
10#: (0x10495E1DC) askpassphrasedialog.cpp - ???
11#: (0x105769E44) slice.h - ???
12#: (0x10576B4C4) slice.h - ???
13#: (0x105693F24) slice.h - ???
Assertion failed: (false), function EncryptWallet, file wallet.cpp, line 661.
[1] 948 abort ./src/qt/dash-qt --testnet

@PastaPastaPasta
Copy link
Member Author

I added a bunch of asserts into this to figure out what exactly is failing and it appears to me to be this that is actually failing

if (!m_batch->Read(key, val)) {

@panleone
Copy link

panleone commented Jan 30, 2024

Pretty sure this happens because all keys are encrypted in a single Transaction (and we do this because if something fails we don't end up with half keys encrypted on db and half keys still unencrypted or still not saved on db).

In this case there are too many keys in a single transaction, which gets too big and at some point we fail to write in the WalletBatch.

@panleone
Copy link

A solution would be doing multiple smaller transactions, but then a smart way to revert everything in case of failure should be implemented too

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

No branches or pull requests

3 participants