Ok, thanks. I see two potential problems in your code:

>     > File chainFileSeed = new File("seed.spvchain");
>     > File chainFile = new File(System.currentTimeMillis() + ".spvchain");
>     > byte[] allBytes = Files.readAllBytes(chainFileSeed.toPath());
>     > Files.write(chainFile.toPath(), allBytes);

What's this "chainFileSeed"? If you're trying to shortcut the
block(header) downloading, I suggest using the CheckpointManager class
instead. See the WalletAppKit.java code and
https://bitcoinj.github.io/speeding-up-chain-sync

>     > Calendar calendar = Calendar.getInstance();
>     > calendar.add(Calendar.MONTH, -1);
>     > Date time = calendar.getTime();
>     > ECKey ecKey = DumpedPrivateKey.fromBase58(netParams,
>     privateKeyAsWiF).getKey();
>     > ecKey.setCreationTimeSeconds(time.getTime() / 1000);

Why don't you use a fixed date here, rather than a relative date? The
key/address you're using was likely created at a fixed date; if current
date minus one month lies before that your test will fail.

That said, it is possible that createBasic() is buggy. The case of a
wallet without keychains (only imported keys) has received less testing.

Can you share the public key part of your key, so that I can run the
exact same test? Or, if your key is worthless, you can just as well
share the private key.


On 18/03/2019 22.10, Juan Ibarra wrote:
> Sure!
> 
> El lunes, 18 de marzo de 2019, 15:53:00 (UTC-4), Andreas Schildbach
> escribió:
> 
>     Can you show the full wallet dumps, not just the balances? And please
>     attach them as text files, not images.
> 
>     Also, can you attach the two logfiles that result from the two runs?
> 
> 
>     On 18/03/2019 19.20, Juan Ibarra wrote:
>     > hello everyone, I Have a backend service this sync wallets whit cron,
>     > today I try to update dependency to 0.15.1 all fine but the sync not
>     > found when use Wallet.creeateBasic, the wallet alwais show 0 BTC,
>     but if
>     > use new Wallet this work fine and show the balance
>     >
>     > I need this to sync over 100 wallets simultaneously,
>     >
>     > Create Basic
>     >
>     > @Test
>     > public void SyncBasicWallet0151() throws Exception {
>     >
>     >     Context.propagate(new Context(netParams));
>     >
>     > File chainFileSeed = new File("seed.spvchain");
>     > File chainFile = new File(System.currentTimeMillis() + ".spvchain");
>     > byte[] allBytes = Files.readAllBytes(chainFileSeed.toPath());
>     > Files.write(chainFile.toPath(), allBytes);
>     >
>     > Calendar calendar = Calendar.getInstance();
>     > calendar.add(Calendar.MONTH, -1);
>     > Date time = calendar.getTime();
>     >
>     > ECKey ecKey = DumpedPrivateKey.fromBase58(netParams,
>     privateKeyAsWiF).getKey();
>     > ecKey.setCreationTimeSeconds(time.getTime() / 1000);
>     > Wallet wallet = Wallet.createBasic(netParams);
>     > wallet.importKey(ecKey);
>     >
>     > BlockStore blockStore = new SPVBlockStore(netParams, chainFile);
>     > BlockChain chain = new BlockChain(netParams, blockStore);
>     > final PeerGroup peerGroup = new PeerGroup(netParams, chain);
>     >
>     > //peerGroup.setBloomFilteringEnabled(false);
>     >
>     > peerGroup.addPeerDiscovery(new DnsDiscovery(netParams));
>     > peerGroup.setFastCatchupTimeSecs(time.getTime());
>     >
>     > peerGroup.addWallet(wallet);
>     > chain.addWallet(wallet);
>     >
>     > peerGroup.start();
>     > peerGroup.downloadBlockChain();
>     > peerGroup.stop();
>     >
>     > chainFile.delete();
>     >
>     > System.out.println(wallet);
>     > wallet.cleanup();
>     > }
>     >
>     >
>     > The output
>     >
>     >
>     > using New Wallet
>     >
>     > @Test
>     > public void SyncBasicWallet0151() throws Exception {
>     >
>     >     Context.propagate(new Context(netParams));
>     >
>     > File chainFileSeed = new File("seed.spvchain");
>     > File chainFile = new File(System.currentTimeMillis() + ".spvchain");
>     > byte[] allBytes = Files.readAllBytes(chainFileSeed.toPath());
>     > Files.write(chainFile.toPath(), allBytes);
>     >
>     > Calendar calendar = Calendar.getInstance();
>     > calendar.add(Calendar.MONTH, -1);
>     > Date time = calendar.getTime();
>     >
>     > ECKey ecKey = DumpedPrivateKey.fromBase58(netParams,
>     privateKeyAsWiF).getKey();
>     > ecKey.setCreationTimeSeconds(time.getTime() / 1000);
>     > Wallet wallet = new Wallet(netParams);
>     > wallet.importKey(ecKey);
>     >
>     > BlockStore blockStore = new SPVBlockStore(netParams, chainFile);
>     > BlockChain chain = new BlockChain(netParams, blockStore);
>     > final PeerGroup peerGroup = new PeerGroup(netParams, chain);
>     >
>     > //peerGroup.setBloomFilteringEnabled(false);
>     >
>     > peerGroup.addPeerDiscovery(new DnsDiscovery(netParams));
>     > peerGroup.setFastCatchupTimeSecs(time.getTime());
>     >
>     > peerGroup.addWallet(wallet);
>     > chain.addWallet(wallet);
>     >
>     > peerGroup.start();
>     > peerGroup.downloadBlockChain();
>     > peerGroup.stop();
>     >
>     > chainFile.delete();
>     >
>     > System.out.println(wallet);
>     > wallet.cleanup();
>     > }
>     >
>     >
>     > The output
>     >
>     > --
>     > 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+u...@googlegroups.com
>     > <mailto:bitcoinj+u...@googlegroups.com>.
>     > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
> 
> 
> -- 
> 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
> <mailto:bitcoinj+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.


-- 
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