Hi.. how did u create the checkpoints file? ...im dealing with the first 
creation of that.
In ur code looks like u ve already did that.. am i wrong?

        CheckpointManager.checkpoint(network,checkpoints, spvStore.get, 
w.getEarliestKeyCreationTime)


thanks for support.. really appreciated


On Monday, April 13, 2015 at 1:48:46 AM UTC+2, Chris Stewart wrote:
>
> Yeah you are right. It didn't change running on mainet though. Here is the 
> piece of code that I was missing for future reference for people looking to 
> solve this question: 
>
> peerGroup.addPeerDiscovery(new DnsDiscovery(network))
>
>
> and now here is the full piece of code in Scala. 
>
>   def wallet (network : NetworkParameters, ecKeys : List[ECKey]) : Wallet = {
>     logger.info("Current directory: " + new java.io.File( "." 
> ).getCanonicalPath)
>     logger.info("The checkpoint file exists: " + new 
> File("checkpoints").exists())
>     logger.info("Creating the wallet on " + network)
>     if (currentWallet.isDefined) {
>         logger.info("Wallet has already been created")
>         currentWallet.get
>     } else {
>       logger.info("Wallet has not been created, instantiating a new one")
>       spvStore = Some(new SPVBlockStore(network, new 
> File("suredbits.spvchain")))
>       logger.info("spvStore")
>       val walletFile = new File(walletFileName + ".wallet")
>       val w = new Wallet(network)
>
>       logger.info("created wallet")
>       w.importKeys(ecKeys)
>       w.autosaveToFile(walletFile, 200, TimeUnit.MILLISECONDS, null)
>       //w.saveToFile(walletFile)
>       if (network != RegTestParams.get) {
>         CheckpointManager.checkpoint(network,checkpoints, spvStore.get, 
> w.getEarliestKeyCreationTime)
>       }
>       chain = Some(new BlockChain(network,w, spvStore.get))
>       val peerGroup : PeerGroup = new PeerGroup(network, chain.get)
>       peerGroup.addPeerDiscovery(new DnsDiscovery(network))
>       logger.info("Connect to " + peerGroup.getConnectedPeers.size + " peers")
>       if(network == RegTestParams.get) {
>         peerGroup.connectToLocalHost()
>         logger.info("connect to local host")
>       }
>       peerGroup.addWallet(w)
>       peerGroup.startAsync()
>       peerGroup.awaitRunning()
>       logger.info("Peer group started")
>       peerGroup.downloadBlockChain()
>       logger.info("Finished downloading blockchain")
>
>       logger.info("Wallet balance after WalletInit: " + w.getBalance())
>       logger.info("Wallet state after WalletInit: " + w.toString())
>       walletPeerGroup = Some(peerGroup)
>       currentWallet = Some(w)
>       w
>   }
> }
>   def stopWallet = {
>     if (walletPeerGroup.isDefined) {
>       walletPeerGroup.get.stopAsync()
>     }
>     if (spvStore.isDefined) spvStore.get.close
>
>   }
>
>
>
> Thanks for your help Mike. 
> On Sunday, April 12, 2015 at 6:54:21 AM UTC-7, Mike Hearn wrote:
>>
>> The checkpoints shipped with bitcoinj are valid only for the main and 
>> test networks, for what I hope are obvious reasons. You can't use 
>> checkpointing in regtest mode. The log shows that you start with a chain of 
>> height >300,000 and then the remote peer does not send you any blocks 
>> because it thinks you have downloaded the block chain already.
>>
>> I'm afraid I'll be away for most of this week in the UK so won't be able 
>> to help you much more with this until I get back. I suggest you spend some 
>> time reviewing the documentation, the bitcoin.org developer guide, and 
>> generally try to ensure your understanding of Bitcoin is as deep as it can 
>> be before proceeding with development.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bitcoinj+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to