mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
settleFromFills now records the proceeds D->C object's (outputID, amount) under the collateral ref (the C->D intentID) via state.PutSettlement, written into the versiondb so it commits atomically with the block. outputID = deriveUTXOID(settlementExportTx.ID(), 0) — the SAME key executeExport puts into shared memory — and the amount is the realized proceeds; both are pure functions of consensus-agreed inputs (blockHash+txIndex seed the export identity), so every validator writes the identical record and the StateRoot stays consensus-safe. The record is purely informational (moves no value; never consulted by the deterministic settle/consume path). dex.getSettlement(collateralRef) reads it back (VM.GetSettlement -> state.GetSettlement) so the off-chain keeper, after submitting the ImportTx + settling RelayOrderTx and the proposer settles, learns the D->C object's outputID + amount and builds the C-side Phase-B ImportSettlement (DS01 outputID|amount|intentID) that consumes the object and emits DEXFill. This closes the keeper's export-discovery gap. Tests: 3 state round-trip/isolation/escrow-coexistence + 3 RPC pending/found/bad-ref, all pass (CGO_ENABLED=0; local cgo accel toolchain is broken — CI builds linux/amd64).