Blockchain download from peer stuck

113 views
Skip to first unread message

Abhay Gupta

unread,
Mar 14, 2023, 12:34:03 PM3/14/23
to bitcoinj
I have setup my own node in AWS, and use that only in peer group. Like below:
peerGroup.addAddress(InetAddress.getByName(host));
peerGroup.setMaxConnections(1);

But it got stuck, and not downloading new blocks of data. Can anyone please help me here? I was debugging from this morning, but can't able to find the issue.

Here are the logs:
org.bitcoinj.core.Peer : Peer{[10.17.10.55]:8333, version=70015, subVer=/Bitcoin Cash Node:24.0.0(EB32.0)/, services=1061 (NETWORK, BLOOM, NETWORK_LIMITED, remaining: 100000), time=2023-03-14 11:21:53, height=783873}: Too many pending pings, disconnecting
org.bitcoinj.core.PeerGroup : [10.17.10.55]:8333: Peer died (2 connected, 0 pending, 1 max)
org.bitcoinj.core.PeerGroup : Download peer died. Picking a new one.
org.bitcoinj.core.PeerGroup : Unsetting download peer: Peer{[10.17.10.55]:8333, version=70015, subVer=/Bitcoin Cash Node:24.0.0(EB32.0)/, services=1061 (NETWORK, BLOOM, NETWORK_LIMITED, remaining: 100000), time=2023-03-14 11:21:53, height=783873}
org.bitcoinj.core.PeerGroup : Setting download peer: Peer{[10.17.10.55]:8333, version=70015, subVer=/Bitcoin Cash Node:24.0.0(EB32.0)/, services=1061 (NETWORK, BLOOM, NETWORK_LIMITED, remaining: 100000), time=2023-03-14 11:21:53, height=783873}
o.b.c.listeners.DownloadProgressTracker : Chain download switched to Peer{[10.17.10.55]:8333, version=70015, subVer=/Bitcoin Cash Node:24.0.0(EB32.0)/, services=1061 (NETWORK, BLOOM, NETWORK_LIMITED, remaining: 100000), time=2023-03-14 11:21:53, height=783873}
org.bitcoinj.core.PeerSocketHandler : [10.17.10.55]:8333 - java.nio.channels.CancelledKeyException
c.PeerGroup$ChainDownloadSpeedCalculator : 0 blocks/sec, 0 tx/sec, 0 pre-filtered tx/sec, avg/last 0.00/0.00 kilobytes per sec, chain/common height 769180/783874, stall disabled (threshold <0.78 KB/sec for 10 seconds)

And then below log groups keeps on coming with waiting time increasing.

org.bitcoinj.core.PeerGroup : [10.17.10.55]:8333: Peer died (0 connected, 0 pending, 1 max)
org.bitcoinj.core.PeerGroup : Peer discovery took 3.630 ?s and returned 0 items from 0 discoverers
org.bitcoinj.core.PeerGroup : Waiting 600066 ms before next connect attempt to [10.17.10.55]:8333

googl...@schildbach.de

unread,
Mar 14, 2023, 12:43:20 PM3/14/23
to bitcoinj
What version of bitcoinj are you using?

It seems the peer was disconnected because of "Too many pending pings, disconnecting". Did Bitcoin Core respond with Pong for every Ping?

I recommend to configure Bitcoin Core logging and look at its logfile. It could yield useful information.

Abhay Gupta

unread,
Mar 14, 2023, 1:30:49 PM3/14/23
to bitcoinj
I am using bitcoincashj version 0.26.2.1 from pokkst/bitcoincashj which is a forked version of bitcoinj. 
I found out some thing that it stucked at block number 783808 (https://www.blockchain.com/explorer/blocks/bch/783808) for which the block size is around 8 Mb. 
It is not able to sync that huge block. Node connection is working fine. As, I have resynced the wallet from start. But it gets stuck at chain height 783807.
Now my question is how to sync big size blocks in bitcoinj?

googl...@schildbach.de

unread,
Mar 14, 2023, 1:38:31 PM3/14/23
to bitcoinj
As far as I remember bitcoinj doesn't support blocks that large. I suspect these limits haven't been properly relaxed by "bitcoincashj".

I strongly recommend getting in contact with them. We don't have the capacity to support forks.

Abhay Gupta

unread,
Mar 15, 2023, 11:23:13 AM3/15/23
to bitcoinj
I have raised the issue with the bitcoincashj creator too. 
His reply was 
It is not the block size that is the issue if I had to guess at first glance. There exist several 8+, especially 32MB, blocks that bitcoincashj can process just fine.
These new blocks seem to be full of OP_RETURN outputs, but I don't know for sure what the cause is right now, and I don't really have the time/interest to figure it out.

Can you please help me with the following points?
1. How exactly is block downloaded in bitcoinj from the node?
2. Where is the size restriction on bitcoinj for block size? I see one in Mainnet params, is it the only one?
3. How exactly can OP_RETURN outputs can cause the sync issue?

Please, I am seeking for some help from you as you know the nits and bits of bitcoinj and bitcoincash is just a hard fork of bitcoin only. 

googl...@schildbach.de

unread,
Mar 15, 2023, 11:27:14 AM3/15/23
to bitcoinj
You could try setting `PeerGroup.setFastCatchupTime()` to the current time to see if it fully synchs the chain. It will receive only the block headers, so neither block size nor the scripts could cause an issue. Besides, I don't think OP_RETURN outputs can cause this – unless bitcoincashj has some special handling we don't have.
Reply all
Reply to author
Forward
0 new messages