Skip to content

Importmulti api is confusing in a way that could lead to funds loss. #9491

@gmaxwell

Description

@gmaxwell

Our normal import interfaces introduce keys with an effective timestamp of 0.

Importmulti introduces keys with a default effective timestamp of 'now'.

While documented it is highly surprising, especially because it contradicts the default on the rescan argument:

"rescan": <false>,         (boolean, optional, default: true) Stating if should rescan the blockchain after all imports

This means you can import a key and reasonably expect that it was rescanned ("I even set rescan true!") but have it not be rescanned, causing you to think the key had been unused and then you give it away and or destroy it and lose funds.

There are a number of other bugs in importmulti (mishandles pruning, needlessly forces the wallet to be unlocked when not importing private keys, etc.) which I am fixing, but I need feedback on this API issue.

Should the default become zero, with -1 special cased as 'now' or make timestamp mandatory? default it to the prune depth??

Should the result also tell us what it rescanned?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions