hsd icon indicating copy to clipboard operation
hsd copied to clipboard

wallet: resend() could be smarter

Open pinheadmz opened this issue 3 years ago • 2 comments

Scenario: you switch from full node to spv node or replace your blockchain db or something that causes the chain to restart at some low height (like 0) but you keep your walletDB. What happens is, the wdb internally unconfirms ALL txs, then when it gets reopened (maybe after a restart) it tries to resend your entire TX history, thinking everything is just pending:

https://github.com/handshake-org/hsd/blob/f28fb9edcf34e78433e4da316d42e82d0d42ee46/lib/wallet/walletdb.js#L1661-L1677

We could probably be smarter about this, and hold off on the resend() if we can determine that the chain's height is way behind the walletdb height

pinheadmz avatar May 13 '22 16:05 pinheadmz

Idea: hsd wallet could just have a --no-resend option and check it in walletDB.syncNode()

pinheadmz avatar May 15 '22 00:05 pinheadmz

Sounds good enough. Have you thought of anything else?

flikites avatar Dec 23 '22 12:12 flikites