|
30 | 30 | #include <impl/dgb/coin/header_chain.hpp> |
31 | 31 | #include <impl/dgb/coin/mempool.hpp> |
32 | 32 | #include <impl/dgb/coin/coin_node.hpp> |
| 33 | +#include <impl/dgb/coin/embedded_coin_node.hpp> |
33 | 34 | #include <impl/dgb/coin/won_block_dispatch.hpp> |
34 | 35 | #include <impl/dgb/stratum/work_source.hpp> |
35 | 36 |
|
@@ -186,14 +187,31 @@ int run_node(const core::CoinParams& params, bool testnet, |
186 | 187 | // NodeImpl ctor opens ~/.c2pool/<net>/sharechain_leveldb and seeds the addr |
187 | 188 | // store from m_bootstrap_addrs, so config must be populated BEFORE |
188 | 189 | // construction (above). |
189 | | - // CoinNode seam — the external-digibyted submitblock FALLBACK leg of the |
190 | | - // #82 dual-path broadcaster, shared by BOTH the sharechain m_on_block_found |
191 | | - // arm (just below) and the miner-facing Stratum arm (further below). |
192 | | - // Declared BEFORE p2p_node so it OUTLIVES the tracker callback that captures |
193 | | - // it. CoinNode(nullptr embedded, nullptr rpc) => has_rpc()==false => |
194 | | - // submit_block_hex returns false LOUDLY (the #163 seam guard: no silent |
195 | | - // drop). Point a real NodeRPC at external digibyted here to light it up. |
196 | | - dgb::coin::CoinNode coin_node(/*embedded=*/nullptr, /*rpc=*/nullptr); |
| 190 | + // §7b embedded chain — backs the in-process work source below and is |
| 191 | + // fed by the embedded P2P header ingest once that lands. Declared HERE |
| 192 | + // (ahead of coin_node) so EmbeddedCoinNode, which holds a HeaderChain&, |
| 193 | + // and coin_node, which holds the EmbeddedCoinNode*, both outlive the |
| 194 | + // tracker callback captured below. The DGBWorkSource further down holds |
| 195 | + // the same non-owning ref. |
| 196 | + c2pool::dgb::HeaderChain header_chain; |
| 197 | + |
| 198 | + // Embedded in-process work source: assembles GBT-compatible templates |
| 199 | + // ENTIRELY from embedded chain state + the coin subsidy schedule (no |
| 200 | + // external digibyted). coinbasevalue resolves through the #207 -> |
| 201 | + // subsidy_func SSOT; transactions[]/bits are held back truthfully until |
| 202 | + // the embedded mempool + next-target source are plumbed. |
| 203 | + dgb::coin::EmbeddedCoinNode embedded_coin(header_chain, params.subsidy_func); |
| 204 | + |
| 205 | + // CoinNode seam — embedded-preferred work source (embedded_coin) with the |
| 206 | + // external-digibyted submitblock FALLBACK leg of the #82 dual-path |
| 207 | + // broadcaster. Shared by BOTH the sharechain m_on_block_found arm (just |
| 208 | + // below) and the miner-facing Stratum arm (further below). Declared |
| 209 | + // BEFORE p2p_node so it OUTLIVES the tracker callback that captures it. |
| 210 | + // rpc=nullptr => has_rpc()==false => submit_block_hex returns false |
| 211 | + // LOUDLY (the #163 seam guard: no silent drop, INDEPENDENT of the |
| 212 | + // embedded source). Point a real NodeRPC at external digibyted here to |
| 213 | + // light the submit sink up. |
| 214 | + dgb::coin::CoinNode coin_node(/*embedded=*/&embedded_coin, /*rpc=*/nullptr); |
197 | 215 |
|
198 | 216 | dgb::Node p2p_node(&ioc, &config); |
199 | 217 | p2p_node.set_target_outbound_peers(4); |
@@ -245,7 +263,8 @@ int run_node(const core::CoinParams& params, bool testnet, |
245 | 263 | // emitted — the standup proves the StratumServer<->IWorkSource wiring |
246 | 264 | // end-to-end. Real work-gen / Scrypt share-validation land in 4b/4c. |
247 | 265 | // This mirrors btc::stratum standing its skeleton wiring up first. |
248 | | - c2pool::dgb::HeaderChain header_chain; // §7b chain, MVP-unwired (empty) |
| 266 | + // header_chain is declared above coin_node (it backs the EmbeddedCoinNode |
| 267 | + // work source); only the unwired Mempool is declared here. |
249 | 268 | dgb::coin::Mempool mempool; // unwired (no UTXO/template feed yet) |
250 | 269 |
|
251 | 270 | // submitblock-RPC arm of the #82 dual-path broadcaster, driven from the |
|
0 commit comments