re-enable wallet in autoprune #6057

Merged
merged 3 commits into from Jun 10, 2015

Conversation

Projects
None yet
6 participants
@jonasschnelli
Member

jonasschnelli commented Apr 24, 2015

No description provided.

@morcos

This comment has been minimized.

Show comment
Hide comment
@morcos

morcos Apr 24, 2015

Member

Nice! I'm glad you looked at this.

The way you checked pindexRescan isn't sufficient however. You can't assume a pruned node has all the blocks past a certain point. Blocks are deleted from disk in the order they were written, which doesn't necessarily correspond with order in the chain. But perhaps you could scan backwards from the Tip until you get to either pindexRescan or one which isn't BLOCK_HAVE_DATA.

Member

morcos commented Apr 24, 2015

Nice! I'm glad you looked at this.

The way you checked pindexRescan isn't sufficient however. You can't assume a pruned node has all the blocks past a certain point. Blocks are deleted from disk in the order they were written, which doesn't necessarily correspond with order in the chain. But perhaps you could scan backwards from the Tip until you get to either pindexRescan or one which isn't BLOCK_HAVE_DATA.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Apr 24, 2015

Member

Right. I did ignore the fact that blocks are not fly in in order. Will change it to your proposed way of scanning backwards.

Same needs to be done for #6058 (edit: already correct there)

Member

jonasschnelli commented Apr 24, 2015

Right. I did ignore the fact that blocks are not fly in in order. Will change it to your proposed way of scanning backwards.

Same needs to be done for #6058 (edit: already correct there)

src/init.cpp
- else
- return InitError(_("Can't run with a wallet in prune mode."));
+ if (GetBoolArg("-rescan", false)) {
+ return InitError(_("Rescans are not possible in pruned mode. You might use -reindex which then download the whole blockchain again."));

This comment has been minimized.

@PRabahy

PRabahy Apr 24, 2015

Contributor

This message is unclear to me. Do you mean:
"Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again."?

@PRabahy

PRabahy Apr 24, 2015

Contributor

This message is unclear to me. Do you mean:
"Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again."?

This comment has been minimized.

@jonasschnelli

jonasschnelli Apr 25, 2015

Member

Thanks!
English is not my mother language and I always struggle with it.
Feel free to also correct/rewrite the other warnings and errors (as well as the code comments).

@jonasschnelli

jonasschnelli Apr 25, 2015

Member

Thanks!
English is not my mother language and I always struggle with it.
Feel free to also correct/rewrite the other warnings and errors (as well as the code comments).

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Apr 26, 2015

Member

Fixed pindexRescan check mentioned by @morcos.

Member

jonasschnelli commented Apr 26, 2015

Fixed pindexRescan check mentioned by @morcos.

@sipa

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Apr 27, 2015

Member

Concept & code review ACK, but this definitely needs testing.

Member

sipa commented Apr 27, 2015

Concept & code review ACK, but this definitely needs testing.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Apr 29, 2015

Member

Also applied an additional test during wallet catchup-rescan if the previous block has TXs but no data to be sure we have pruned this block.

Member

jonasschnelli commented Apr 29, 2015

Also applied an additional test during wallet catchup-rescan if the previous block has TXs but no data to be sure we have pruned this block.

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli May 28, 2015

Member

Rebased.

Member

jonasschnelli commented May 28, 2015

Rebased.

- else
- return InitError(_("Can't run with a wallet in prune mode."));
+ if (GetBoolArg("-rescan", false)) {
+ return InitError(_("Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again."));

This comment has been minimized.

@luke-jr

luke-jr Jun 2, 2015

Member

What prevents this error if the user has passed -reindex? In particular, a pruned node may not have the space for the whole blockchain, and may need to redownload it with pruning enabled.

(... btw, does -reindex actually work correctly with pruned data? I think last time I tried, it ignored blocks after the first missing one, and redownloaded/reappended them...)

@luke-jr

luke-jr Jun 2, 2015

Member

What prevents this error if the user has passed -reindex? In particular, a pruned node may not have the space for the whole blockchain, and may need to redownload it with pruning enabled.

(... btw, does -reindex actually work correctly with pruned data? I think last time I tried, it ignored blocks after the first missing one, and redownloaded/reappended them...)

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Jun 10, 2015

Member

utACK.

Member

laanwj commented Jun 10, 2015

utACK.

@laanwj laanwj merged commit 7e6569e into bitcoin:master Jun 10, 2015

1 check passed

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

laanwj added a commit that referenced this pull request Jun 10, 2015

Merge pull request #6057
7e6569e [squashme] improve/corrects prune mode detection test for required wallet rescans (Jonas Schnelli)
7a12119 [RPC] disable import functions in pruned mode (Jonas Schnelli)
3201035 [autoprune] allow wallet in pruned mode (Jonas Schnelli)

@laanwj laanwj referenced this pull request Jun 15, 2015

Closed

Autoprune #4701

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

Merge pull request #6057: re-enable wallet in autoprune
7e6569e [squashme] improve/corrects prune mode detection test for required wallet rescans (Jonas Schnelli)
7a12119 [RPC] disable import functions in pruned mode (Jonas Schnelli)
3201035 [autoprune] allow wallet in pruned mode (Jonas Schnelli)

@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