Author

Topic: understanding the checkpoints concept (Read 2373 times)

member
Activity: 66
Merit: 16
bitcoin core contributor
September 24, 2013, 09:39:15 AM
#5
Code:
wallet.clearTransactions(0)
works just perfect.

Thanks!
legendary
Activity: 1526
Merit: 1134
September 24, 2013, 08:16:43 AM
#4
Sure you can. You just have some code like in WalletAppKit that does the following:

Code:
boolean chainFileExisted = chainFile.exists();
boolean shouldReplayWallet = vWalletFile.exists() && !chainFileExists;
BlockStore store = new SPVBlockStore(params, chainFile);

... later ....

                if (shouldReplayWallet)
                    wallet.clearTransactions(0);

Now when you start things up the wallet will contain only keys (and, uh, extension data, but that's a bug). The chain file will start at zero or wherever you checkpointed to (i.e. earliest key time), the wallet will have no transactions in it, and the replay will get you back in sync with the network.
member
Activity: 66
Merit: 16
bitcoin core contributor
September 24, 2013, 08:10:39 AM
#3
Thanks for the doc link (overlooked that).

So you're saying, that i can't replace/exchange a .wallet file (even when i nicely close the app first), delete the .spvchain file and re-sync with the network?
Just to know: I don't have a use case for that, i just feel i need to understand that correct. Smiley

--
legendary
Activity: 1526
Merit: 1134
September 24, 2013, 07:52:00 AM
#2
Docs here:

https://code.google.com/p/bitcoinj/wiki/SpeedingUpChainSync

When you delete the SPV chain file, at the moment the application is supposed to call wallet.clearTransactions(0). WalletAppKit does this for you. Replaying a wallet into an already full wallet will mess it up, but there aren't any assertions to catch that at the current time.
member
Activity: 66
Merit: 16
bitcoin core contributor
September 24, 2013, 03:12:14 AM
#1
Hi

1)
I've played a bit with bitcoinj but still does not understand the concept of the checkpoint-file (i could also not found any docs about it).
Is anyone willing to explain that shortly?

2)
I also don't understand why my transactions "jump back" to "pending" confidence (= balance of 0 BTC) when i delete the .spvchain file (while leaving the .wallet file) and recreate/redownload the .spvchain.
Is there something like "recheck the .spvchain and rebuilt transactions in my current wallet"?

thanks
---
Jump to: