Bitcoin Forum
May 06, 2024, 08:11:11 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: understanding the checkpoints concept  (Read 2351 times)
jonas.schnelli (OP)
Member
**
Offline Offline

Activity: 66
Merit: 10

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>
1714983071
Hero Member
*
Offline Offline

Posts: 1714983071

View Profile Personal Message (Offline)

Ignore
1714983071
Reply with quote  #2

1714983071
Report to moderator
1714983071
Hero Member
*
Offline Offline

Posts: 1714983071

View Profile Personal Message (Offline)

Ignore
1714983071
Reply with quote  #2

1714983071
Report to moderator
1714983071
Hero Member
*
Offline Offline

Posts: 1714983071

View Profile Personal Message (Offline)

Ignore
1714983071
Reply with quote  #2

1714983071
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714983071
Hero Member
*
Offline Offline

Posts: 1714983071

View Profile Personal Message (Offline)

Ignore
1714983071
Reply with quote  #2

1714983071
Report to moderator
1714983071
Hero Member
*
Offline Offline

Posts: 1714983071

View Profile Personal Message (Offline)

Ignore
1714983071
Reply with quote  #2

1714983071
Report to moderator
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526
Merit: 1129


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 (OP)
Member
**
Offline Offline

Activity: 66
Merit: 10

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
Merit: 1129


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 (OP)
Member
**
Offline Offline

Activity: 66
Merit: 10

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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!