Skip to content

Commit 0eca6f6

Browse files
authored
dgb: stand up embedded coin-daemon ingest surface in run-loop (#250)
Construct dgb::interfaces::Node (coin/node_interface.hpp) in run_node and subscribe BOTH the HeaderChain and the Mempool to its new_headers / new_tx feeds via the wire_header_ingest + wire_mempool_ingest SSOT connectors. This is the CONSUMER seam the embedded coin-daemon P2P node (coin/p2p_node.hpp NodeP2P) binds against: NodeP2P fires new_headers on each received headers batch and new_tx on each relayed tx; routing both through the wire_*_ingest connectors makes a live feed flow into HeaderChain::validate_and_append and Mempool::add_tx the moment the NodeP2P producer is connected (its construct + connect is the next slice). header+mempool ingest wired together. coin_iface is declared AFTER header_chain + mempool so it (and its event subscriptions, whose handlers capture chain/pool by reference) destructs first. No behavior change this slice: with no NodeP2P producer constructed yet the feeds never fire, so chain + mempool stay byte-identical to before. main_dgb.cpp links the full dgb codec, so the mempool_ingest.hpp #143 SCC note is satisfied. Single-file (src/c2pool/main_dgb.cpp). Build EXIT=0, --selftest OK. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
1 parent 552399e commit 0eca6f6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/c2pool/main_dgb.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#include <impl/dgb/coin/coin_node.hpp>
3333
#include <impl/dgb/coin/embedded_coin_node.hpp>
3434
#include <impl/dgb/coin/won_block_dispatch.hpp>
35+
#include <impl/dgb/coin/node_interface.hpp>
36+
#include <impl/dgb/coin/header_ingest.hpp>
37+
#include <impl/dgb/coin/mempool_ingest.hpp>
3538
#include <impl/dgb/stratum/work_source.hpp>
3639

3740
#include <core/filesystem.hpp>
@@ -267,6 +270,33 @@ int run_node(const core::CoinParams& params, bool testnet,
267270
// work source); only the unwired Mempool is declared here.
268271
dgb::coin::Mempool mempool; // unwired (no UTXO/template feed yet)
269272

273+
// ── Embedded coin-daemon ingest surface (Phase B P2P-node standup) ──
274+
//
275+
// dgb::interfaces::Node (coin/node_interface.hpp) is the shared-state
276+
// surface the embedded coin-daemon P2P node (coin/p2p_node.hpp, NodeP2P)
277+
// binds against: NodeP2P fires new_headers on each received `headers`
278+
// batch and new_tx on each relayed `tx`. Construct it here and subscribe
279+
// BOTH the HeaderChain and the Mempool to those feeds through the
280+
// wire_*_ingest SSOT connectors (coin/header_ingest.hpp,
281+
// coin/mempool_ingest.hpp), so a live header/tx feed flows into
282+
// HeaderChain::validate_and_append and Mempool::add_tx the moment the
283+
// NodeP2P is connected (NodeP2P construct + connect is the next slice).
284+
// Declared AFTER header_chain + mempool so coin_iface (and its event
285+
// subscriptions) destructs FIRST: the wire_*_ingest handlers capture
286+
// chain/pool by reference and must not outlive them. The returned
287+
// EventDisposable handles are held for the run-loop lifetime.
288+
//
289+
// No behavior change this slice: with no NodeP2P producer constructed yet,
290+
// new_headers/new_tx never fire, so the chain and mempool stay exactly as
291+
// before. This stands the CONSUMER seam up that the NodeP2P producer binds
292+
// to next — header+mempool ingest together, the unblock order integrator
293+
// directed (2026-06-20).
294+
dgb::interfaces::Node coin_iface;
295+
auto header_ingest_sub = c2pool::dgb::wire_header_ingest(coin_iface, header_chain);
296+
auto mempool_ingest_sub = c2pool::dgb::wire_mempool_ingest(coin_iface, mempool);
297+
std::cout << "[DGB] embedded coin-daemon ingest surface up — header+tx "
298+
"feeds wired (NodeP2P producer standup next)" << std::endl;
299+
270300
// submitblock-RPC arm of the #82 dual-path broadcaster, driven from the
271301
// miner-facing Stratum path. Reuses the SAME coin_node seam declared above
272302
// p2p_node (the sharechain arm shares it). rpc.cpp:387 submit_block_hex is

0 commit comments

Comments
 (0)