Decouple app/tx from Application

This commit is contained in:
JCW
2026-01-09 12:13:21 +00:00
parent 69b2be8654
commit 8bba90df0f
61 changed files with 379 additions and 196 deletions

View File

@@ -0,0 +1,36 @@
#ifndef XRPL_CORE_NETWORKIDSERVICE_H_INCLUDED
#define XRPL_CORE_NETWORKIDSERVICE_H_INCLUDED
#include <cstdint>
namespace xrpl {
/** Service that provides access to the network ID.
This service provides read-only access to the network ID configured
for this server. The network ID identifies which network (mainnet,
testnet, devnet, or custom network) this server is configured to
connect to.
Well-known network IDs:
- 0: Mainnet
- 1: Testnet
- 2: Devnet
- 1025+: Custom networks (require NetworkID field in transactions)
*/
class NetworkIDService
{
public:
virtual ~NetworkIDService() = default;
/** Get the configured network ID
*
* @return The network ID this server is configured for
*/
virtual std::uint32_t
getNetworkID() const = 0;
};
} // namespace xrpl
#endif

View File

@@ -4,10 +4,11 @@
#include <xrpl/basics/Blob.h>
#include <xrpl/basics/SHAMapHash.h>
#include <xrpl/basics/TaggedCache.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/ledger/CachedSLEs.h>
#include <xrpl/protocol/Protocol.h>
#include <boost/asio.hpp>
#include <boost/asio/io_context.hpp>
#include <cstdint>
#include <memory>
@@ -30,6 +31,7 @@ class AmendmentTable;
class Application;
class Cluster;
class CollectorManager;
class Config;
class DatabaseCon;
class Family;
class HashRouter;
@@ -43,6 +45,7 @@ class LoadFeeTrack;
class LoadManager;
class ManifestCache;
class NetworkOPs;
class NetworkIDService;
class OpenLedger;
class OrderBookDB;
class Overlay;
@@ -102,6 +105,9 @@ public:
virtual CachedSLEs&
cachedSLEs() = 0;
virtual NetworkIDService&
getNetworkIDService() = 0;
// Protocol and validation services
virtual AmendmentTable&
getAmendmentTable() = 0;
@@ -217,6 +223,9 @@ public:
virtual Logs&
logs() = 0;
virtual std::optional<uint256> const&
trapTxID() const = 0;
// Temporary: Get the underlying Application for functions that haven't
// been migrated yet. This should be removed once all code is migrated.
virtual Application&