zebra icon indicating copy to clipboard operation
zebra copied to clipboard

Add `startingheight` field to `getpeers` RPC

Open teor2345 opened this issue 2 years ago • 2 comments

Motivation

When Zebra is syncing to the tip, s-nomp and equihash-solomining log a confusing message:

[PoolWorker][Thread 0][2023/02/01 09:58:22] Daemon is still syncing with network (download blockchain) - server will be started once synced                                                                
[PoolWorker][Thread 0][2023/02/01 09:58:22] Downloaded NaN% of blockchain from 6 peers                                                                                                                     
[PoolWorker][Thread 0][2023/02/01 09:58:27] Downloaded NaN% of blockchain from 6 peers 

https://github.com/s-nomp/node-stratum-pool/blob/d86ae73f8ff968d9355bb61aac05e0ebef36ccb5/lib/pool.js#L181

The mining pools still work, so this is not a blocker, but it might be confusing to users.

Specifications

https://zcash.github.io/rpc/getpeerinfo.html

Complex Code or Requirements

We'll need to add a VersionMessage or a starting height to each peer address. We already have a shared Arc<ConnectionInfo> in each peer and connection object.

Here is the address struct we need to modify: https://github.com/ZcashFoundation/zebra/blob/dc43dca06f8eed275235110e57e643caef0daa26/zebra-network/src/meta_addr.rs#L126-L133

We'll need to update it for each new connection to the peer. Here is where we need to add the connection_info: https://github.com/ZcashFoundation/zebra/blob/dc43dca06f8eed275235110e57e643caef0daa26/zebra-network/src/peer/handshake.rs#L898

We can do this using a new MetaAddr constructor, which generates a new MetaAddrChange variant: https://github.com/ZcashFoundation/zebra/blob/dc43dca06f8eed275235110e57e643caef0daa26/zebra-network/src/meta_addr.rs#L191-L194

And then we can apply that change to the existing address (if there is one): https://github.com/ZcashFoundation/zebra/blob/dc43dca06f8eed275235110e57e643caef0daa26/zebra-network/src/meta_addr.rs#L786-L790

Testing

Update the existing snapshot tests. Run s-nomp or equihash-solomining and check the output while syncing.

teor2345 avatar Feb 01 '23 00:02 teor2345

Hey team! Please add your planning poker estimate with Zenhub @arya2 @conradoplg @dconnolly @oxarbitrage @teor2345 @upbqdn

mpguerra avatar Feb 02 '23 17:02 mpguerra

Need to figure out if anyone needs this

mpguerra avatar Oct 14 '24 14:10 mpguerra

Closing. We will implement this if requested.

natalieesk avatar Oct 07 '25 10:10 natalieesk