Testnet "Block does not connect" and endless 0 blocks/sec

247 views
Skip to first unread message

spic...@gmail.com

unread,
Nov 16, 2015, 10:28:34 PM11/16/15
to bitcoinj
Here is a gist with the logs from two recent attempts to catch up on TestNet. 


Both of them report "Block does not connect" about twice very early, throw from "blockChainDownloadLocked" and quickly degrade into this state:

[PeerGroup Thread] INFO org.bitcoinj.core.PeerGroup - 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 0.00/0.00 kilobytes per sec (stall threshold <1.56 KB/sec for 10 seconds)

I'm hoping someone more experienced can figure out why.

Andreas Schildbach

unread,
Nov 17, 2015, 11:40:58 AM11/17/15
to bitc...@googlegroups.com
What version of bitcoinj is this on? Did you do any custom
modifications? Do these problems also appear on other chains (e.g. mainnet)?

Testnet seems to be quite forked these days, possibly a consequence from
BIP65 and BIP66. For me on v0.13.3, this manifests in a slightly
different pattern: A huge amount of "Pending block download: <hash>"
messages and also the occasional "java.lang.Throwable at
org.bitcoinj.core.Peer.blockChainDownloadLocked(Peer.java:1300)".
> --
> 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.


spic...@gmail.com

unread,
Nov 17, 2015, 10:36:08 PM11/17/15
to bitcoinj
Hi Andreas,

It was on the latest, 0.13.3

Perhaps I need some guidance on testing things.  Are we to disregard testnet bugs now?  Do most people simply test with tiny amounts on mainnet?

Kal 1

unread,
Nov 18, 2015, 6:21:59 AM11/18/15
to bitcoinj
I think this maybe an issue with the BIP 34. The first error I saw in testnet was after 51 blocks (counter) was seen and this code was triggered.... (From an empty store). It could be that the format of the coinbase was just incorrect (I don't know enough), or this is a bug. I think maybe better answered by the person that implemented it?

It seems that the height has less bytes (2- because it doesn't need them). I don't know if this is expected format input or not. Later on there are blocks that do exactly the opposite (I.e.3 bytes when only 2 are required).

Kal 1

unread,
Nov 18, 2015, 9:27:35 AM11/18/15
to bitcoinj
Actually I'm on the latest and greatest so this might not be the reason for this particular issue (still there is something weird going on)....

spic...@gmail.com

unread,
Nov 21, 2015, 1:22:57 PM11/21/15
to bitcoinj
This is still happening.  Am I the only one who cannot catch up on testnet?  My last block was:

12:19:00.076 [main] INFO  org.bitcoinj.core.AbstractBlockChain - chain head is at height 584264:

v536870919 block: 

   previous block: 00000000000004986759c05de678ab05a33baf94884812d22b61f9d1ba5ab76d

   merkle root: a62458f3a31355c2d7db137c4e79dfc8ea736f2de5e026b9c8e5ae08e0727154

   time: [1447084244] 2015-11-09T15:50:44Z

   difficulty target (nBits): 486604799

   nonce: 4142204204

Andreas Schildbach

unread,
Nov 22, 2015, 3:58:37 PM11/22/15
to bitc...@googlegroups.com
We're currently testing (and will be soon merging) a PR that fixes an
error checking the block height in the coinbase:
https://github.com/bitcoinj/bitcoinj/pull/1117

It's currently an issue on testnet only. If you're not running in fully
validating mode it is unlikely to affect you at all, but who knows maybe
it helps in your case. If you want to try it out, feel free to do so
(and tell us what you find).

spic...@gmail.com

unread,
Nov 22, 2015, 7:57:02 PM11/22/15
to bitcoinj
I switched to master and confirmed that the same issue existed (compared with 0.13.3)

I then incorporated PR 117, and it sadly did not help.

However, I fear my condition may have further degenerated because now immediately after starting there's a chain hight mismatch complaint:

18:46:07.549 [main] INFO  org.bitcoinj.core.AbstractBlockChain - chain head is at height 584264:
v536870919 block: 
   previous block: 00000000000004986759c05de678ab05a33baf94884812d22b61f9d1ba5ab76d
   merkle root: a62458f3a31355c2d7db137c4e79dfc8ea736f2de5e026b9c8e5ae08e0727154
   time: [1447084244] 2015-11-09T15:50:44Z
   difficulty target (nBits): 486604799
   nonce: 4142204204

18:46:07.777 [main] WARN  org.bitcoinj.core.AbstractBlockChain - Wallet/chain height mismatch: 584168 vs 584264
18:46:07.778 [main] WARN  org.bitcoinj.core.AbstractBlockChain - Hashes: 00000000000008cef27f8d7894692dd1ec620b0cf42121de97282b12ce71a2ef vs 000000000004f17beacd43dba2a8c36d5474f35594cdea5b4721bb11d254872c
18:46:07.778 [main] WARN  org.bitcoinj.core.AbstractBlockChain - Rollback of block store failed, continuing with mismatched heights. This can happen due to a replay.



Please let me know if there is anything else I should be trying.

spic...@gmail.com

unread,
Nov 22, 2015, 7:57:51 PM11/22/15
to bitcoinj
Of course I meant  PR 1117

spic...@gmail.com

unread,
Nov 22, 2015, 8:14:35 PM11/22/15
to bitcoinj
To clarify, the message "org.bitcoinj.core.AbstractBlockChain - Wallet/chain height mismatch: 584168 vs 584264" occurs on master with or without PR 1117, but does not occur on 0.13.3


Kal 1

unread,
Nov 24, 2015, 3:06:58 PM11/24/15
to bitcoinj
I've had a thought that may explain things... (Are you using Linux?)  assuming your store is not corrupted.

It maybe due to that fact that the table/columns for MySQL have changed in 0.14 (it's not backward compatible).  This will mean you will have to drop the tables and re-sync, always an option . I know a pain (ideally do this).
So if you are using 0.14 (with patch) with a store that was created using 0.13.3 this may cause you problems (on Linux/Unix etc). There is a pending back port for this, although this will not help you here.

You could manually change the table names and columns - basically lower case them. Although I would probably not do this (too error prone), just drop the tables and re-sync testnet
(***make sure you drop them though***).
The existing structure really shouldn't change from now on, hence it will be backward compatible in the future.

Backup your schema/database if you really don't want to lose what you have (then again it is testnet and your store may already be corrupted now).

FYI: I managed to sync testnet using latest (0.14) and the patch.

spic...@gmail.com

unread,
Nov 25, 2015, 12:25:41 AM11/25/15
to bitcoinj
I'm on OSX using mysql.  This schema change may in fact be my trouble with 0.14, but of course I was already having trouble with 0.13.3 on testnet, and was only trying master to see if any recent work fixed my issue.

I'm happy to drop the old tables if necessary, but I'd like to know if you think this will address anything that was going wrong on 0.13.3, or only the incompatibility introduced with 0.14?  Also, I assume this will leave me in a state where I can no longer use the release version of bitcoinj?

Kalpesh

unread,
Nov 25, 2015, 2:33:22 AM11/25/15
to bitc...@googlegroups.com, bitcoinj

Since you are on Mac OSX the database is probably, at least the structure, not your issue here.

You can never guarantee anything, but I'm confident that you should be new able to sync testnet with latest & patch from *scratch*... Give this a go first.

If you can, wait till the PR has been included into latest, shouldn't be long, Andreas is usually quick to close off PR's, then just use latest, better that way really- that's just *me* though.

Yes you are correct that you will be stuck on a non release version.

Just don't forget to drop that tables (manually) before you use 0.14.

Sent from TypeMail

--
You received this message because you are subscribed to a topic in the Google Groups "bitcoinj" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bitcoinj/S0j2t7AKgzo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bitcoinj+u...@googlegroups.com.

Kalpesh

unread,
Nov 25, 2015, 2:40:19 AM11/25/15
to bitc...@googlegroups.com, bitcoinj

Missed the important part... Yes 0.14 will address the issues you were having in 0.13.3 with syncing testnet.

Sent from TypeMail

Kal 1

unread,
Nov 25, 2015, 6:16:02 AM11/25/15
to bitcoinj
Update.... Just use the latest dev- the patch has already been merged. Andreas is too efficient - I need to check before I assume it hasn't been done yet :-)



To unsubscribe from this group and all its topics, send an email to bitcoinj+unsubscribe@googlegroups.com.

spic...@gmail.com

unread,
Nov 26, 2015, 11:31:52 AM11/26/15
to bitcoinj
I created a fresh DB and bitcoinj 0.14 (master) was seemingly able to catch all the way up.  However, as soon as I stopped and restarted, I saw the following:



09:50:58.584 [main] INFO  o.b.s.DatabaseFullPrunedBlockStore - com.mysql.jdbc.Driver loaded. 
09:50:58.590 [main] INFO  o.b.s.DatabaseFullPrunedBlockStore - Made a new connection to database jdbc:mysql://localhost/blockstore_testnet3
09:50:58.645 [main] WARN  org.bitcoinj.core.Context - Implicitly creating context. This is a migration step and this message will eventually go away.
09:50:58.689 [main] INFO  org.bitcoinj.core.AbstractBlockChain - chain head is at height 607429:
 block: 
   hash: 00000000003b40109ed97aae2a6e74b2b92cf500e0b1d878e14f3dd1b06aaaf7   version: 4 (BIP34, BIP66, BIP65)
   previous block: 00000000003ff55525408f562f70e5062099d9a98971c556db72c5d1b8de8a03
   merkle root: 609b6cd34da964a07b007afeeb9eb07d91d291ed216fb4fbc3d7f233f0afdb52
   time: [1448559924] 2015-11-26T17:45:24Z
   difficulty target (nBits): 486604799
   nonce: 2910893642

09:50:59.037 [main] WARN  org.bitcoinj.core.AbstractBlockChain - Wallet/chain height mismatch: 607428 vs 607429
09:50:59.037 [main] WARN  org.bitcoinj.core.AbstractBlockChain - Hashes: 00000000003ff55525408f562f70e5062099d9a98971c556db72c5d1b8de8a03 vs 00000000003b40109ed97aae2a6e74b2b92cf500e0b1d878e14f3dd1b06aaaf7
09:50:59.037 [main] WARN  org.bitcoinj.core.AbstractBlockChain - Rollback of block store failed, continuing with mismatched heights. This can happen due to a replay.
09:51:00.665 [PeerGroup Thread] INFO  org.bitcoinj.core.PeerGroup - Starting ...
09:51:00.682 [PeerGroup Thread] INFO  org.bitcoinj.core.PeerGroup - Localhost peer not detected.
09:51:03.548 [PeerGroup Thread] INFO  org.bitcoinj.core.PeerGroup - Peer discovery took 2866ms and returned 61 items
09:51:03.548 [PeerGroup Thread] INFO  org.bitcoinj.core.PeerGroup - Waiting 2868 msec before next connect attempt to [195.154.173.26]:18333
09:51:06.421 [PeerGroup Thread] INFO  org.bitcoinj.core.PeerGroup - Attempting connection to [198.11.214.146]:18333     (0 connected, 1 pending, 12 max)
...


09:57:26.690 [NioClientManager] INFO  o.b.s.DatabaseFullPrunedBlockStore - Made a new connection to database jdbc:mysql://localhost/blockstore_testnet3
09:57:26.698 [NioClientManager] ERROR org.bitcoinj.core.AbstractBlockChain - Failed to verify block: 
org.bitcoinj.core.VerificationException: Block larger than MAX_BLOCK_SIZE
at org.bitcoinj.core.Block.verifyTransactions(Block.java:701) ~[classes/:na]
at org.bitcoinj.core.AbstractBlockChain.add(AbstractBlockChain.java:470) [classes/:na]
at org.bitcoinj.core.AbstractBlockChain.add(AbstractBlockChain.java:354) [classes/:na]
at org.bitcoinj.core.Peer.processBlock(Peer.java:887) [classes/:na]
at org.bitcoinj.core.Peer.processMessage(Peer.java:404) [classes/:na]
at org.bitcoinj.core.PeerSocketHandler.receiveBytes(PeerSocketHandler.java:142) [classes/:na]
at org.bitcoinj.net.ConnectionHandler.handleKey(ConnectionHandler.java:223) [classes/:na]
at org.bitcoinj.net.NioClientManager.handleKey(NioClientManager.java:86) [classes/:na]
at org.bitcoinj.net.NioClientManager.run(NioClientManager.java:122) [classes/:na]
at com.google.common.util.concurrent.AbstractExecutionThreadService$1$2.run(AbstractExecutionThreadService.java:60) [guava-16.0.1.jar:na]
at com.google.common.util.concurrent.Callables$3.run(Callables.java:93) [guava-16.0.1.jar:na]
at org.bitcoinj.utils.ContextPropagatingThreadFactory$1.run(ContextPropagatingThreadFactory.java:35) [classes/:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
09:57:26.698 [NioClientManager] ERROR org.bitcoinj.core.AbstractBlockChain - 0000000000021d8af00040ad4acec550e6299c3d78f5b730196e5088739ff807
09:57:26.698 [NioClientManager] WARN  o.b.s.DatabaseFullPrunedBlockStore - Warning: Rollback attempt without transaction
09:57:27.217 [NioClientManager] WARN  org.bitcoinj.core.Peer - [104.223.101.187]:18333: Block verification failed
org.bitcoinj.core.VerificationException: Could not verify block:
 block: 
   hash: 0000000000021d8af00040ad4acec550e6299c3d78f5b730196e5088739ff807   version: 536870919 (BIP34, BIP66, BIP65, BIP101)
   previous block: 00000000000003d597bcc45cac641d0e6fa02942475250307ee829726d8cf240
   merkle root: 1203e8a1b12623f578cbdaba29e7946388fdb2b8099c9fb997fc2c490b5f91a4
   time: [1448553454] 2015-11-26T15:57:34Z
   difficulty target (nBits): 486604799
   nonce: 2640845494
   with 3020 transaction(s):
  b1ccde412d07d5abaaed3acb807dffbf73c49cd07268a2306774269ad2d204a9: Unknown confidence level.
     == COINBASE TXN (scriptSig ???)  (scriptPubKey ???)
  3b6c2a36577d7e050c8393f2f164baa0c3ecf7c12268e9534038f1404552d81f: Unknown confidence level.
     in   0[] PUSHDATA(72)[3045022100a17555ed2639c21276a7d0e38bc384e95f7908ae82f5c91721880faef77ef9e402200ca1ebe44a601ef86573f96deac1e13344fd1725780033ba2700d78876f2f5a701] PUSHDATA(71)[304402207cdc1b545853c923a0b5a728bc6f87c847183af38ae2ac1b4c9802672b95ec41022060900711c58ae69f2f4ba9f700af82c850deb77ed93f229ca4c8fa84d273588101] PUSHDATA(71)[522102632178d046673c9729d828cfee388e121f497707f810c131e0d3fc0fe0bd66d62103a0951ec7d3a9da9de171617026442fcd30f34d66100fab539853b43f508787d452ae]
          outpoint:1bba0359009c7e21051982c5dc3a737e003a682349461654a11f9d888a1c3644:1
     out  HASH160 PUSHDATA(20)[8931008ad3dbaf0ccc01d480efe505b5fcce76ed] EQUAL 0.01 BTC
     out  HASH160 PUSHDATA(20)[8ce5408cfeaddb7ccb2545ded41ef47810945484] EQUAL 40.24146 BTC
  67c789c5ca43c8a088b767d54495116ebb1d78f82c940d0bf95c42cb3831c2ff: Unknown confidence level.
     in   0[] PUSHDATA(71)[304402202cca8910a723e5e9ab6567e9f88b67a123acdf94f0f213f2258e0cdb8c2841ea02204b55b37727d9aee7a5bbd4059085b31051593f7bead3b040714847d8438626f001] PUSHDATA(72)[3045022100d005688d5b15ac1985ae2f127e5bc29a6dad83df4e9e0873b61c9315ffea2316022033e70ed2b1efeb3c8ec030bab7c2cb56039ce718dccc7cea39d66ad792f0289e01] PUSHDATA(71)[522102632178d046673c9729d828cfee388e121f497707f810c131e0d3fc0fe0bd66d62103a0951ec7d3a9da9de171617026442fcd30f34d66100fab539853b43f508787d452ae]
...



It's an epically long exception -- about 900K lines.  

The stacktrace is 13MB. 

Seriously.


Kal 1

unread,
Nov 26, 2015, 3:07:21 PM11/26/15
to bitcoinj
Well at least you have made progress (the previous bug has gone).

How are you shutting down? Is the wallet being saved? It looks to me like the store received as block whilst the wallet wasn't attached (while shutting down maybe)? Posting your code here might be helpful, without that it's very difficult (at least for me :-)

This is now a different issue, so I would probably re-post it so others may be able to help, and it keeps issues contained. To get over this condition right now (temp) I believe you should be able to reset the wallet, re-sync (just for now- also this is good to know anyway in case things go wrong).

Check out WalletTool.  It is a helpful utility class for working with wallets (docs can be found on the web site I believe).
Reply all
Reply to author
Forward
0 new messages