mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The in-luxd native D-Chain VM (pkg/dchain) bootstrapped consensus but never exposed order ingestion: VM.CreateHandlers returned an empty map, so luxd mounted nothing and /ext/bc/D/* 404'd. RegisterCLOB (the clob_* -> submitTx -> mempool -> consensus -> Verify-match path) was only reachable over the ZAP socket transport, which only cmd/dvenue (the abandoned standalone venue) wires. Wire ingestion the idiomatic luxd way: CreateHandlers now returns one HTTP handler per CLOB method (/dex/clob_place, /dex/clob_submit, ...), each adapting the EXACT same rpc.RawHandler RegisterCLOB binds (one method->handler table, two transports — vm.clobMethods). luxd mounts each as an exact route under /ext/bc/<chainID> (and the D alias) through the node's own router. An order POSTed to /ext/bc/D/dex/clob_submit flows submitTx -> mempool.Add -> consensus PendingTxs -> BuildBlock -> Block.Verify (the matcher) -> Block.Accept, and the response is the CONSENSUS-COMPUTED outcome. No external matcher, no relay, no side port, no node image change — the chain is the matcher. TDD: TestIngestCrossingOrdersMatchInBlock proves two crossing orders submitted over the HTTP handler produce a fill committed as D-Chain state (trade: row, height advances). CGO=0; full pkg/dchain suite green; plugin cross-builds linux/amd64.