|
| 1 | +#pragma once |
| 2 | + |
| 3 | +// --------------------------------------------------------------------------- |
| 4 | +// dgb::coin::CoinNode -- concrete core::coin::ICoinNode for DGB (family-1 P2 |
| 5 | +// WorkView seam, Path A minimal-stub). 1:1 mirror of btc::coin::CoinNode |
| 6 | +// (src/impl/btc/coin/coin_node.{hpp,cpp}), which is itself member-mapped from |
| 7 | +// the ltc::coin::CoinNode reference -- the control flow / sequencing are the |
| 8 | +// load-bearing part and are preserved verbatim: |
| 9 | +// m_embedded : CoinNodeInterface* -- embedded in-process source |
| 10 | +// m_rpc : NodeRPC* -- external coin-RPC client (STUB) |
| 11 | +// work : Variable<rpc::WorkData> -- full per-coin WorkData kept |
| 12 | +// coin-side; only the agnostic |
| 13 | +// WorkView slice crosses the seam |
| 14 | +// |
| 15 | +// DGB Path A status: both work sources behind this adapter are stubs -- |
| 16 | +// NodeRPC throws on getwork() (rpc.hpp) and no EmbeddedCoinNode exists until |
| 17 | +// the M3 daemon slice -- so a wired DGB node reports "no template" loudly |
| 18 | +// through the ICoinNode contract rather than fabricating work. The adapter |
| 19 | +// itself is COMPLETE: when either source becomes real, no seam-side change |
| 20 | +// is needed. |
| 21 | +// |
| 22 | +// Build-INERT: defines the type; NOT yet wired into web_server or a |
| 23 | +// main_dgb.cpp (no such binary split exists yet). Registration follows the |
| 24 | +// ci-steward OBJECT-lib convention; see src/impl/dgb/CMakeLists.txt. |
| 25 | +// --------------------------------------------------------------------------- |
| 26 | + |
| 27 | +#include <string> |
| 28 | + |
| 29 | +#include <core/coin/node_iface.hpp> |
| 30 | +#include <core/coin/work_view.hpp> |
| 31 | +#include <core/events.hpp> |
| 32 | + |
| 33 | +#include "rpc.hpp" |
| 34 | +#include "rpc_data.hpp" |
| 35 | +#include "template_builder.hpp" |
| 36 | + |
| 37 | +namespace dgb |
| 38 | +{ |
| 39 | + |
| 40 | +namespace coin |
| 41 | +{ |
| 42 | + |
| 43 | +class CoinNode : public core::coin::ICoinNode |
| 44 | +{ |
| 45 | + // Embedded in-process template source (EmbeddedCoinNode, M3). May be null |
| 46 | + // when the node runs RPC-only. is_embedded() reports its presence. |
| 47 | + CoinNodeInterface* m_embedded = nullptr; |
| 48 | + |
| 49 | + // External coin-RPC client. May be null in embedded-preferred mode; it is |
| 50 | + // the sole sink for submit_block_hex(). has_rpc() reports its presence. |
| 51 | + NodeRPC* m_rpc = nullptr; |
| 52 | + |
| 53 | + // Full per-coin WorkData retained coin-side via work.set(wd); only the |
| 54 | + // agnostic WorkView slice crosses the seam into core/web_server. |
| 55 | + Variable<rpc::WorkData> work; |
| 56 | + |
| 57 | +public: |
| 58 | + CoinNode(CoinNodeInterface* embedded, NodeRPC* rpc) |
| 59 | + : m_embedded(embedded), m_rpc(rpc) {} |
| 60 | + |
| 61 | + core::coin::WorkView get_work_view() override; |
| 62 | + bool submit_block_hex(const std::string& block_hex, bool ignore_failure) override; |
| 63 | + |
| 64 | + bool is_embedded() const override { return m_embedded != nullptr; } |
| 65 | + bool has_rpc() const override { return m_rpc != nullptr; } |
| 66 | +}; |
| 67 | + |
| 68 | +} // namespace coin |
| 69 | + |
| 70 | +} // namespace dgb |
0 commit comments