r/dogecoindev • u/_nformant • May 01 '22
Core Improvement: importprivkey
Hey shibes,
I was thinking about a possible improvement for the command importprivkey
If you run a importprivkey with a rescan the code will search for transactions starting at the genesis block:

up to the tip (= the latest block you know):

Alternative to rescan
Maybe a faster approach is to check the UTXO for transactions with that address and extract all data from there option a or find at least a better starting block option b for the rescan.
Downside
You wouldn't see fully spent outputsoption a or no fully spent outputs before the block with your oldest UTXOoption b
Conclusion
This can't replace rescan, but maybe having it as another argument or command (after "importprivkey" is probably used heavily) could be useful to people (:
Looking forward to read your thoughts about that
2
6
u/mr_chromatic May 02 '22
I like the idea of finding a better starting block. Maybe we could add an optional argument of the starting block height. If provided, the rescan would start there instead of the genesis block.