Bitcoin Forum
November 24, 2017, 08:52:10 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: understanding the checkpoints concept  (Read 2238 times)
jonas.schnelli
Member
**
Offline Offline

Activity: 66

bitcoin core contributor


View Profile WWW
September 24, 2013, 08: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
---
</jonas>
1511556730
Hero Member
*
Offline Offline

Posts: 1511556730

View Profile Personal Message (Offline)

Ignore
1511556730
Reply with quote  #2

1511556730
Report to moderator
Join ICO Now Coinlancer is Disrupting the Freelance marketplace!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1511556730
Hero Member
*
Offline Offline

Posts: 1511556730

View Profile Personal Message (Offline)

Ignore
1511556730
Reply with quote  #2

1511556730
Report to moderator
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
September 24, 2013, 12:52:00 PM
 #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.
jonas.schnelli
Member
**
Offline Offline

Activity: 66

bitcoin core contributor


View Profile WWW
September 24, 2013, 01:10:39 PM
 #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

--
</jonas>
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
September 24, 2013, 01:16:43 PM
 #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.
jonas.schnelli
Member
**
Offline Offline

Activity: 66

bitcoin core contributor


View Profile WWW
September 24, 2013, 02:39:15 PM
 #5

Code:
wallet.clearTransactions(0)
works just perfect.

Thanks!
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!