handshake-org / handshake-org/hsd

Network issues with testnet caused by lack of blocks

Open
#366 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.1k
Forks
306
PR merge metrics
No merged PRs in 30d

Description

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.

https://github.com/handshake-org/hsd/blob/61defcc4c930ece17d80056885c035e322dbebac/lib/blockchain/chain.js#L2701-L2718

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

Contributor guide

Open the contributing guide

Research direction

Start with lib/blockchain/chain.js at lines 2701-2718 and review how testnet nodes enter and leave syncing. Compare the reported peer and getblocks behavior with the intended testnet behavior, then determine whether the outcome should be a FAQ/documentation update or a scoped code change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, networking
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.