You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Review finding: photon relays only a small fraction of native-lane blocks, because it identifies blocks by the leading 64 bits of their hash #388
qbit-photon identifies a block by the leading 64 bits of its hash. For native-lane (non-AuxPoW) blocks, those bits are bounded by the proof-of-work target and take only a handful of values. Most native-lane blocks are therefore treated as already known and are not relayed.
Severity: high (functional). Blocks still propagate over normal P2P, so this costs PHOTON's latency benefit for native-lane blocks, not correctness. Found in a 2026-11-09 review of 1.x.xd647580885; the PHOTON code is unchanged since v1.0.0.
Observed
Confidence: high from code and from a replay of mainnet block hashes. There is no end-to-end harness run against live relays.
Identifier.HashPrefixFromHex (contrib/photon/src/relay_engine.cpp:70-86) packs the first 16 display-hex characters, which are the most significant 64 bits of the hash. The hash comes from ZMQ hashblock in display order (contrib/photon/src/app.cpp:374-381).
Proof of work. Native-lane proof of work is checked on the block hash itself (src/auxpow_validation.cpp:157), so its high bits are bounded by the target. At the current native-lane nBits (0x19027c8e) the prefix can only be 0, 1 or 2. AuxPoW-lane block hashes are unconstrained, because their proof of work is on the parent.
Seen set. The seen set holds 16 prefixes (relay_engine.h:27). A known prefix is dropped without refreshing it, in three places:
outbound, relay_engine.cpp:162-168;
inbound header and chunk, :203-213 and :291-301.
Entries leave the set only when 16 newer, distinct prefixes are inserted (:396-424), and in practice only AuxPoW-lane blocks supply new prefixes.
Replay. Replaying the mainnet chain's block hashes through this logic:
74 of the last 1,595 native-lane blocks would be relayed;
all AuxPoW-lane blocks would be relayed;
native-lane prefixes in the last 20,000 blocks took only 7 distinct values.
Impact
Miners and pools that rely on PHOTON for low-latency propagation of native-lane blocks get it for only about 5% of those blocks. The known counter rises, but nothing reports the drop as a fault.
Suggested fix
Identify blocks by bits that proof of work does not constrain, such as the least significant 64 bits of the hash. Alternatively, carry the full 32-byte hash in the header packet and derive the chunk identifier from unconstrained bits.
Tests:
a relay-engine test with consecutive hashes that share the leading 64 bits but differ in the low bits, both relayed;
a replay test over a recorded sequence of mainnet hashes, every block relayed exactly once.
Related: #381 (per-peer limits and checks before submission) does not change the identifier scheme.
Fixed on 1.x.x by #410 (a811585271), which ships in v1.0.1: qbit-photon now identifies a block by the low-order 64 bits of its hash (BlockIdFromHex), which proof of work does not constrain, and still recognizes the leading-bits form that earlier versions announce. Tests in contrib/photon/test/relay_engine_tests.cpp: blocks_sharing_leading_hash_bits_all_relayed and mainnet_hash_sequence_relayed_without_suppression.
Closing by hand, because a merge into 1.x.x does not close issues automatically.
Activity
kiwidream commentedon Nov 12, 2026
Fixed on
1.x.xby #410 (a811585271), which ships in v1.0.1: qbit-photon now identifies a block by the low-order 64 bits of its hash (BlockIdFromHex), which proof of work does not constrain, and still recognizes the leading-bits form that earlier versions announce. Tests incontrib/photon/test/relay_engine_tests.cpp:blocks_sharing_leading_hash_bits_all_relayedandmainnet_hash_sequence_relayed_without_suppression.Closing by hand, because a merge into
1.x.xdoes not close issues automatically.