Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network issues with testnet caused by lack of blocks #366

Open
pinheadmz opened this issue Feb 10, 2020 · 1 comment
Open

Network issues with testnet caused by lack of blocks #366

pinheadmz opened this issue Feb 10, 2020 · 1 comment

Comments

@pinheadmz
Copy link
Member

I'm not sure if we need to try to solve these issues with code (the solution would be something like adding if (testnet) everywhere or modifying the common if (!this.syncing)) but I wanted to document since I suspect it could be a FAQ:

hsd thinks it is "syncing" (i.e. initial block download)

The main culprit here is that the last block is over 40 minutes old. There are no checkpoints and the minimum chain work is 0. Once a node has switched synced to true, it is mostly latched until restart, meaning this is a particular problem for new nodes on testnet.

hsd/lib/blockchain/chain.js

Lines 2701 to 2718 in 61defcc

maybeSync() {
if (this.synced)
return;
if (this.options.checkpoints) {
if (this.height < this.network.lastCheckpoint)
return;
}
if (!this.hasChainwork())
return;
if (this.tip.time < this.network.now() - this.network.block.maxTipAge)
return;
this.synced = true;
this.emit('full');
}

Node behavior when syncing is true

  • No peers are syncable (allowed to be synced from) except the loader peer, which must be an outbound connection. Therefore if you connect to Alice's node and mine a block, Alice will not accept it because Alice is "syncing" and you are not her loader peer.

  • Peers send getblocks, receive nothing in response, timeout after 30 seconds, and disconnect... repeatedly. Since we think we are syncing we expect peers to have blocks for us. They don't. One possible solution for this is to send empty INV messages back if there are no blocks in the chain following the requesting peer's getblocks stop

@pinheadmz
Copy link
Member Author

This also blocks rpc getblocktemplate, making mining impossible, meaning testnet can't really proceed at all. I'm trying to CPU mine with hsd by itself just to hopefully get one block added to the chain so it thinks its "synced" and start generating block templates for hs-miner:

hsd/lib/node/rpc.js

Lines 1347 to 1350 in 9d21a04

if (!this.chain.synced) {
throw new RPCError(errs.CLIENT_IN_INITIAL_DOWNLOAD,
'Node is downloading blocks...');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant