go-blockchain/p2p
Claude fcb867d53b
fix(p2p): correct network IDs and serialisation for C++ daemon compat
Three bugs found by integration testing against the C++ testnet daemon:

1. NetworkIDMainnet/Testnet had byte 10 swapped — the C++ #ifndef TESTNET
   branch (mainnet) sets P2P_NETWORK_ID_TESTNET_FLAG=1, and the #else
   (testnet) sets it to 0. Counter-intuitive but matches compiled binaries.

2. ClientVersion format "Lethean/go-blockchain 0.1.0" was rejected by the
   daemon's parse_client_version which expects "major.minor.rev.build[commit]".
   Changed to "6.0.1.2[go-blockchain]".

3. RequestChain, RequestGetObjects, and ResponseGetObjects used StringArrayVal
   for hash fields, but the C++ daemon uses KV_SERIALIZE_CONTAINER_POD_AS_BLOB
   which packs all 32-byte hashes into a single concatenated blob. Also,
   ResponseChainEntry.m_block_ids is an object array of block_context_info
   (hash + cumulative size), not a simple hash list.

Co-Authored-By: Charon <charon@lethean.io>
2026-02-21 21:17:48 +00:00
..
commands.go feat(p2p): CORE_SYNC_DATA type and command ID constants 2026-02-20 19:34:12 +00:00
handshake.go feat(p2p): handshake command with NodeData and peerlist decoding 2026-02-20 19:41:25 +00:00
handshake_test.go fix(p2p): correct network IDs and serialisation for C++ daemon compat 2026-02-21 21:17:48 +00:00
integration_test.go test(p2p): integration test against C++ testnet daemon 2026-02-20 19:45:24 +00:00
ping.go feat(p2p): ping command encode/decode 2026-02-20 19:34:36 +00:00
ping_test.go feat(p2p): ping command encode/decode 2026-02-20 19:34:36 +00:00
relay.go fix(p2p): correct network IDs and serialisation for C++ daemon compat 2026-02-21 21:17:48 +00:00
relay_test.go fix(p2p): correct network IDs and serialisation for C++ daemon compat 2026-02-21 21:17:48 +00:00
sync.go feat(p2p): CORE_SYNC_DATA type and command ID constants 2026-02-20 19:34:12 +00:00
sync_test.go feat(p2p): CORE_SYNC_DATA type and command ID constants 2026-02-20 19:34:12 +00:00
timedsync.go feat(p2p): timed sync and block/tx relay command types 2026-02-20 19:41:30 +00:00