The /api/ping_neighbor endpoint currently hardcodes 1-byte addressing for target_id, but path_hash_mode (on feat/companion) now supports 2-byte and 3-byte path hashes.
Current behavior
api_endpoints.py line ~2103:
target_hash=int(target_id,16)iftarget_hash<0ortarget_hash>255:returnself._error("target_id must be a valid byte (0x00-0xFF)")
Three places are locked to 1 byte:
Input validation — rejects anything > 0xFF
Trace packet — path=[target_hash] passes a single byte
Response formatting — f"0x{target_hash:02x}" and f"0x{h:02x}" for path hops
Requested change
When config.mesh.path_hash_mode is 1 (2-byte) or 2 (3-byte):
Accept wider target_id values (up to 0xFFFF / 0xFFFFFF)
Pass the appropriately-sized hash to PacketBuilder.create_trace()
Format response target_id and path hops with the matching width (04x / 06x)
This would let the console (and upstream UI) ping using the full hash precision the user has configured.
## Summary
The `/api/ping_neighbor` endpoint currently hardcodes 1-byte addressing for `target_id`, but `path_hash_mode` (on `feat/companion`) now supports 2-byte and 3-byte path hashes.
## Current behavior
`api_endpoints.py` line ~2103:
```python
target_hash = int(target_id, 16)
if target_hash < 0 or target_hash > 255:
return self._error("target_id must be a valid byte (0x00-0xFF)")
```
Three places are locked to 1 byte:
1. **Input validation** — rejects anything > `0xFF`
2. **Trace packet** — `path=[target_hash]` passes a single byte
3. **Response formatting** — `f"0x{target_hash:02x}"` and `f"0x{h:02x}"` for path hops
## Requested change
When `config.mesh.path_hash_mode` is `1` (2-byte) or `2` (3-byte):
- Accept wider `target_id` values (up to `0xFFFF` / `0xFFFFFF`)
- Pass the appropriately-sized hash to `PacketBuilder.create_trace()`
- Format response `target_id` and `path` hops with the matching width (`04x` / `06x`)
This would let the console (and upstream UI) ping using the full hash precision the user has configured.
<!-- github-sync-id:4050357371 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The
/api/ping_neighborendpoint currently hardcodes 1-byte addressing fortarget_id, butpath_hash_mode(onfeat/companion) now supports 2-byte and 3-byte path hashes.Current behavior
api_endpoints.pyline ~2103:Three places are locked to 1 byte:
0xFFpath=[target_hash]passes a single bytef"0x{target_hash:02x}"andf"0x{h:02x}"for path hopsRequested change
When
config.mesh.path_hash_modeis1(2-byte) or2(3-byte):target_idvalues (up to0xFFFF/0xFFFFFF)PacketBuilder.create_trace()target_idandpathhops with the matching width (04x/06x)This would let the console (and upstream UI) ping using the full hash precision the user has configured.
Have committed
155575865acan you please test.{"success": true, "data": {"target_id": "0xb8c1", "rtt_ms": 1427.48, "snr_db": 0, "rssi": 0, "path": ["0xb8c1"], "tag": 1855790637, "path_hash_mode": 1}, "message": "Ping successful"}%
confirmed ping works as designed!