@@ -276,23 +276,26 @@ inline uint256 share_init_verify(const DashShare& share,
276276 hash_link_data.insert (hash_link_data.end (), p, p + 4 );
277277 }
278278 // Append outer coinbase_payload (coinbase_payload_data in Python).
279- // Oracle data.py:278,346-348: coinbase_payload_data = pack.VarStrType().pack(payload)
280- // = [compactsize(len)][payload]; check_hash_link appends THAT (or b"" when None).
281- // BaseScript C2POOL_SERIALIZE_METHODS does READWRITE(m_data) over a byte vector,
282- // which strips one VarStr layer on read (so m_data holds the RAW payload) and
283- // re-adds the compactsize prefix on write. Serialize via the stream rather than
284- // appending m_data raw — the raw append dropped the prefix, diverging gentx_hash
285- // from the oracle on any non-empty (DIP4 CbTx) payload. PRESERVE the empty branch:
286- // the oracle appends nothing (b"") when the payload is None/empty, NOT a 0x00.
279+ // Oracle data.py:277-289: the outer contents['coinbase_payload'] VALUE is
280+ // coinbase_payload_data = pack.VarStrType().pack(raw_payload) — i.e. the
281+ // VarStr-PACKED payload ([compactsize(len)][payload]) — and Share.__init__
282+ // (data.py:346-348) appends that value VERBATIM to the check_hash_link
283+ // data (b"" when None). On the wire the PossiblyNone(b'', VarStr) outer
284+ // layer adds one MORE compactsize prefix around the value, so
285+ // DashFormatter's single READWRITE(m_data) strip leaves m_data holding
286+ // exactly the oracle field value: [compactsize(len raw)][raw]. Append it
287+ // RAW. (#412 correctly established that the compactsize prefix belongs in
288+ // this data — but re-serializing m_data as a VarStr added a SECOND prefix
289+ // on top of the one m_data already carries, diverging gentx_hash from the
290+ // oracle on every real DIP4 CbTx share. The share-producer slice pins the
291+ // corrected framing: producer KATs in test_dash_share_producer.cpp,
292+ // updated oracle anchors in test_dash_share_hash_link.cpp.)
293+ // PRESERVE the empty branch: the oracle appends nothing (b"") when the
294+ // payload is None/empty, NOT a 0x00.
287295 {
288296 auto & cpd = share.m_coinbase_payload_outer .m_data ;
289297 if (!cpd.empty ())
290- {
291- PackStream cpd_stream;
292- cpd_stream << share.m_coinbase_payload_outer ; // VarStr-pack: [compactsize][payload]
293- auto * cp = reinterpret_cast <const unsigned char *>(cpd_stream.data ());
294- hash_link_data.insert (hash_link_data.end (), cp, cp + cpd_stream.size ());
295- }
298+ hash_link_data.insert (hash_link_data.end (), cpd.begin (), cpd.end ());
296299 }
297300
298301 auto gentx_before_refhash = compute_gentx_before_refhash ();
0 commit comments