Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.h
// Copyright (c) 2018 The Bitcoin Core developers | // Copyright (c) 2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_INTERFACES_CHAIN_H | #ifndef BITCOIN_INTERFACES_CHAIN_H | ||||
#define BITCOIN_INTERFACES_CHAIN_H | #define BITCOIN_INTERFACES_CHAIN_H | ||||
#include <memory> | #include <memory> | ||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
class CChainParams; | |||||
class CScheduler; | |||||
namespace interfaces { | namespace interfaces { | ||||
//! Interface for giving wallet processes access to blockchain state. | //! Interface for giving wallet processes access to blockchain state. | ||||
class Chain { | class Chain { | ||||
public: | public: | ||||
virtual ~Chain() {} | virtual ~Chain() {} | ||||
//! Interface for querying locked chain state, used by legacy code that | //! Interface for querying locked chain state, used by legacy code that | ||||
Show All 16 Lines | public: | ||||
virtual std::unique_ptr<Lock> assumeLocked() = 0; | virtual std::unique_ptr<Lock> assumeLocked() = 0; | ||||
}; | }; | ||||
//! Interface to let node manage chain clients (wallets, or maybe tools for | //! Interface to let node manage chain clients (wallets, or maybe tools for | ||||
//! monitoring and analysis in the future). | //! monitoring and analysis in the future). | ||||
class ChainClient { | class ChainClient { | ||||
public: | public: | ||||
virtual ~ChainClient() {} | virtual ~ChainClient() {} | ||||
//! Register rpcs. | |||||
virtual void registerRpcs() = 0; | |||||
//! Check for errors before loading. | |||||
virtual bool verify(const CChainParams &chainParams) = 0; | |||||
//! Load saved state. | |||||
virtual bool load(const CChainParams &chainParams) = 0; | |||||
//! Start client execution and provide a scheduler. | |||||
virtual void start(CScheduler &scheduler) = 0; | |||||
//! Save state to disk. | |||||
virtual void flush() = 0; | |||||
//! Shut down client. | |||||
virtual void stop() = 0; | |||||
}; | }; | ||||
//! Return implementation of Chain interface. | //! Return implementation of Chain interface. | ||||
std::unique_ptr<Chain> MakeChain(); | std::unique_ptr<Chain> MakeChain(); | ||||
//! Return implementation of ChainClient interface for a wallet client. This | //! Return implementation of ChainClient interface for a wallet client. This | ||||
//! function will be undefined in builds where ENABLE_WALLET is false. | //! function will be undefined in builds where ENABLE_WALLET is false. | ||||
//! | //! | ||||
Show All 11 Lines |