handshake-org / handshake-org/hsd
Large wallet TX breaks txdb, prevents wallet from advancing
- Dominant language
- JavaScript
- Stars
- 2.1k
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
This is a vague issue placeholder that needs to be looked in to more, but I have heard from more than one power-user of hsd having this problem. The symptom is a wallet that refuses to advance past a certain block, and rescans and chain resets don't seem to help. Could be accompanied by the log message `[warning] (wallet) Rescan block too high: ...`. In the two cases I know about, the issue was traced to very large transaction sent by the wallet (>100 inputs and >100 outputs). Increasing memory availability with `--max-old-space-size` doesn't necessarily fix the issue, but in one case just deleting the walletDB and starting over did.
We should check the code path when a wallet TX is confirmed for quadratic memory usage or other inefficiencies related to large TX size (for example: are we copying the TX into memory once _per input_ during some part of the process?)
Contributor guide
Research direction
No file or test is named. Start at the wallet transaction-confirmation path and the source of the “Rescan block too high” warning, then trace how large transactions move through txdb. Done means identifying and addressing the memory inefficiency, with behavior checked against a transaction exceeding 100 inputs and outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, databases, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100