Enable wallet key imports without rescan in pruned mode. #6645

Merged
merged 1 commit into from Sep 23, 2015

Conversation

Projects
None yet
6 participants
@gmaxwell
Member

gmaxwell commented Sep 7, 2015

Complete rescan is incompatible with pruning, but rescan is optional on
our wallet key import RPCs. Import on use is very useful in some common
situations in conjunction with pruning, e.g. merchant payment tracking.

This reenables importprivkey/importaddress/importpubkey when rescan
is not used.

In the future we should consider changing the rescan argument to allow depth
or date to allow limited rescanning when compatible with the retained
block depth.

Enable wallet key imports without rescan in pruned mode.
Complete rescan is incompatible with pruning, but rescan is optional on
 our wallet key import RPCs.  Import on use is very useful in some common
 situations in conjunction with pruning, e.g. merchant payment tracking.

This reenables importprivkey/importaddress/importpubkey when rescan
 is not used.

In the future we should consider changing the rescan argument to allow depth
 or date to allow limited rescanning when compatible with the retained
 block depth.
@gmaxwell

This comment has been minimized.

Show comment
Hide comment
@gmaxwell

gmaxwell Sep 7, 2015

Member

I only performed the most trivial of tests. I am opening this PR somewhat prematurely because I don't know why it wasn't done this way in the first place, and wanted to find out if there was some huge reason I was missing before I spent more time testing. :)

Member

gmaxwell commented Sep 7, 2015

I only performed the most trivial of tests. I am opening this PR somewhat prematurely because I don't know why it wasn't done this way in the first place, and wanted to find out if there was some huge reason I was missing before I spent more time testing. :)

@gmaxwell

This comment has been minimized.

Show comment
Hide comment
@gmaxwell

gmaxwell Sep 7, 2015

Member

@jonasschnelli Above question is wrt 7a12119.

Member

gmaxwell commented Sep 7, 2015

@jonasschnelli Above question is wrt 7a12119.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Sep 7, 2015

Member

Nice!

Right. I should have this done in the fist place.

utACK.

Member

jonasschnelli commented Sep 7, 2015

Nice!

Right. I should have this done in the fist place.

utACK.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Sep 7, 2015

Member

There is also a PR that would optimize importing depth:
#6570

Member

jonasschnelli commented Sep 7, 2015

There is also a PR that would optimize importing depth:
#6570

@gmaxwell

This comment has been minimized.

Show comment
Hide comment
@gmaxwell

gmaxwell Sep 7, 2015

Member

Awesome. Okay I'll run it through some more test cases then!

Member

gmaxwell commented Sep 7, 2015

Awesome. Okay I'll run it through some more test cases then!

@gmaxwell gmaxwell added the Wallet label Sep 7, 2015

@fanquake

This comment has been minimized.

Show comment
Hide comment
@fanquake

fanquake Sep 7, 2015

Member

utACK

Member

fanquake commented Sep 7, 2015

utACK

@dcousens

This comment has been minimized.

Show comment
Hide comment
@dcousens

dcousens Sep 7, 2015

Contributor

utACK && concept ACK

Contributor

dcousens commented Sep 7, 2015

utACK && concept ACK

@gmaxwell

This comment has been minimized.

Show comment
Hide comment
@gmaxwell

gmaxwell Sep 7, 2015

Member

I've tested this more extensively now and can't seem to break it.

Member

gmaxwell commented Sep 7, 2015

I've tested this more extensively now and can't seem to break it.

@@ -114,6 +112,9 @@ UniValue importprivkey(const UniValue& params, bool fHelp)
if (params.size() > 2)
fRescan = params[2].get_bool();
+ if (fRescan && fPruneMode)
+ throw JSONRPCError(RPC_WALLET_ERROR, "Rescan is disabled in pruned mode");

This comment has been minimized.

@btcdrak

btcdrak Sep 7, 2015

Member

Maybe "Wallet rescanning is disabled in pruned mode"?

@btcdrak

btcdrak Sep 7, 2015

Member

Maybe "Wallet rescanning is disabled in pruned mode"?

This comment has been minimized.

@gmaxwell

gmaxwell Sep 7, 2015

Member

Technically it is the blockchain that is rescanned. But these options have a boolean parameter "rescan" which defaults, so what its saying is that this option is disabled.

I think if I were to clarify this further I would say that the rescan option was disabled. Or maybe to be kind to translaters say something like the requested rescan depth was too deep (as I expect we'll further parameterize this in the future).

@gmaxwell

gmaxwell Sep 7, 2015

Member

Technically it is the blockchain that is rescanned. But these options have a boolean parameter "rescan" which defaults, so what its saying is that this option is disabled.

I think if I were to clarify this further I would say that the rescan option was disabled. Or maybe to be kind to translaters say something like the requested rescan depth was too deep (as I expect we'll further parameterize this in the future).

This comment has been minimized.

@btcdrak

btcdrak Sep 7, 2015

Member

You could just say "The -rescan option is disabled in pruned mode" which would be more clear (to me at least :)

@btcdrak

btcdrak Sep 7, 2015

Member

You could just say "The -rescan option is disabled in pruned mode" which would be more clear (to me at least :)

This comment has been minimized.

@laanwj

laanwj Sep 8, 2015

Member

But this isn't about the -rescan option, but rescans triggered some other way. I think the message is OK.

@laanwj

laanwj Sep 8, 2015

Member

But this isn't about the -rescan option, but rescans triggered some other way. I think the message is OK.

This comment has been minimized.

@laanwj

laanwj Sep 8, 2015

Member

The only improvement I can think of would be to add a comment to the error message that it is possible to pass 'false' as the rescan parameter to avoid this error.

You don't have to worry about translators, RPC error messages aren't translated.

@laanwj

laanwj Sep 8, 2015

Member

The only improvement I can think of would be to add a comment to the error message that it is possible to pass 'false' as the rescan parameter to avoid this error.

You don't have to worry about translators, RPC error messages aren't translated.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Sep 8, 2015

Member

utACK

Member

laanwj commented Sep 8, 2015

utACK

@laanwj laanwj merged commit 77c6072 into bitcoin:master Sep 23, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Sep 23, 2015

Merge pull request #6645
77c6072 Enable wallet key imports without rescan in pruned mode. (Gregory Maxwell)

luke-jr added a commit to luke-jr/bitcoin that referenced this pull request Dec 28, 2015

Partial: Enable wallet key imports without rescan in pruned mode.
Complete rescan is incompatible with pruning, but rescan is optional on
 our wallet key import RPCs.  Import on use is very useful in some common
 situations in conjunction with pruning, e.g. merchant payment tracking.

This reenables importprivkey/importaddress when rescan is not used.

In the future we should consider changing the rescan argument to allow depth
 or date to allow limited rescanning when compatible with the retained
 block depth.

Github-Pull: #6645
Partial-Rebased-From: 77c6072

@str4d str4d referenced this pull request in zcash/zcash Mar 29, 2017

Open

Bitcoin 0.12 wallet PRs 1 #2225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment