mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The luxd plugin transport (vm/rpc) resolves Block.Accept by ID via VM.GetBlock — unlike Block.Verify, which carries the full block bytes (ParseBlock). The dexvm's GetBlock only indexed ACCEPTED blocks, so GetBlock(builtID) for a block the engine had just built returned ErrNotFound; the engine's self-finalize Accept (finalizeOwnProposal) became a silent no-op, the clob_* submitTx waiter (handler.go) hung forever, and the consensus forwarder wedged inside the hung Accept so NO further D-Chain blocks were ever built. The EVM survives the same ID-only Accept because geth resolves built-but-unaccepted blocks from its block cache; the dexvm had no equivalent. Add a processingBlocks index (built/verified-but-unaccepted blocks): BuildBlock and ParseBlock record into it (ParseBlock returns the stable instance so Verify's stashed overlay is the one Accept commits), GetBlock consults it after acceptedBlocks, and Accept/Reject prune it. Smallest change that makes the plugin Accept(ID) round-trip resolve the same instance built/verified — no transport, engine, or matcher change. TDD: TestVMAcceptViaGetBlock drives the exact plugin path BuildBlock -> GetBlock(id) -> Accept (proven to FAIL without the lookup: 'not found, the production stall'); TestVMParseVerifyAcceptByID covers the follower ParseBlock -> Verify -> GetBlock(id) -> Accept. Full pkg/dchain suite green CGO=0. Every prior test accepted the *Block from BuildBlock directly, skipping the ID-resolve path the live node uses.