BSHA3  0.17.99
P2P Blockchain, based on Bitcoin
Public Types | Public Member Functions | List of all members
interfaces::Node Class Referenceabstract

Top-level interface for a bitcoin node (bsha3d process). More...

#include <node.h>

Public Types

using NodesStats = std::vector< std::tuple< CNodeStats, bool, CNodeStateStats > >
 Get stats for connected nodes. More...
 
using InitMessageFn = std::function< void(const std::string &message)>
 Register handler for init messages. More...
 
using MessageBoxFn = std::function< bool(const std::string &message, const std::string &caption, unsigned int style)>
 Register handler for message box messages. More...
 
using QuestionFn = std::function< bool(const std::string &message, const std::string &non_interactive_message, const std::string &caption, unsigned int style)>
 Register handler for question messages. More...
 
using ShowProgressFn = std::function< void(const std::string &title, int progress, bool resume_possible)>
 Register handler for progress messages. More...
 
using LoadWalletFn = std::function< void(std::unique_ptr< Wallet > wallet)>
 Register handler for load wallet messages. More...
 
using NotifyNumConnectionsChangedFn = std::function< void(int new_num_connections)>
 Register handler for number of connections changed messages. More...
 
using NotifyNetworkActiveChangedFn = std::function< void(bool network_active)>
 Register handler for network active messages. More...
 
using NotifyAlertChangedFn = std::function< void()>
 Register handler for notify alert messages. More...
 
using BannedListChangedFn = std::function< void()>
 Register handler for ban list messages. More...
 
using NotifyBlockTipFn = std::function< void(bool initial_download, int height, int64_t block_time, double verification_progress)>
 Register handler for block tip messages. More...
 
using NotifyHeaderTipFn = std::function< void(bool initial_download, int height, int64_t block_time, double verification_progress)>
 Register handler for header tip messages. More...
 

Public Member Functions

virtual ~Node ()
 
virtual bool parseParameters (int argc, const char *const argv[], std::string &error)=0
 Set command line arguments. More...
 
virtual bool softSetArg (const std::string &arg, const std::string &value)=0
 Set a command line argument if it doesn't already have a value. More...
 
virtual bool softSetBoolArg (const std::string &arg, bool value)=0
 Set a command line boolean argument if it doesn't already have a value. More...
 
virtual bool readConfigFiles (std::string &error)=0
 Load settings from configuration file. More...
 
virtual void selectParams (const std::string &network)=0
 Choose network parameters. More...
 
virtual std::string getNetwork ()=0
 Get network name. More...
 
virtual void initLogging ()=0
 Init logging. More...
 
virtual void initParameterInteraction ()=0
 Init parameter interaction. More...
 
virtual std::string getWarnings (const std::string &type)=0
 Get warnings. More...
 
virtual uint32_t getLogCategories ()=0
 
virtual bool baseInitialize ()=0
 Initialize app dependencies. More...
 
virtual bool appInitMain ()=0
 Start node. More...
 
virtual void appShutdown ()=0
 Stop node. More...
 
virtual void startShutdown ()=0
 Start shutdown. More...
 
virtual bool shutdownRequested ()=0
 Return whether shutdown was requested. More...
 
virtual void setupServerArgs ()=0
 Setup arguments. More...
 
virtual void mapPort (bool use_upnp)=0
 Map port. More...
 
virtual bool getProxy (Network net, proxyType &proxy_info)=0
 Get proxy. More...
 
virtual size_t getNodeCount (CConnman::NumConnections flags)=0
 Get number of connections. More...
 
virtual bool getNodesStats (NodesStats &stats)=0
 
virtual bool getBanned (banmap_t &banmap)=0
 Get ban map entries. More...
 
virtual bool ban (const CNetAddr &net_addr, BanReason reason, int64_t ban_time_offset)=0
 Ban node. More...
 
virtual bool unban (const CSubNet &ip)=0
 Unban node. More...
 
virtual bool disconnect (NodeId id)=0
 Disconnect node. More...
 
virtual int64_t getTotalBytesRecv ()=0
 Get total bytes recv. More...
 
virtual int64_t getTotalBytesSent ()=0
 Get total bytes sent. More...
 
virtual size_t getMempoolSize ()=0
 Get mempool size. More...
 
virtual size_t getMempoolDynamicUsage ()=0
 Get mempool dynamic usage. More...
 
virtual bool getHeaderTip (int &height, int64_t &block_time)=0
 Get header tip height and time. More...
 
virtual int getNumBlocks ()=0
 Get num blocks. More...
 
virtual int64_t getLastBlockTime ()=0
 Get last block time. More...
 
virtual double getVerificationProgress ()=0
 Get verification progress. More...
 
virtual bool isInitialBlockDownload ()=0
 Is initial block download. More...
 
virtual bool getReindex ()=0
 Get reindex. More...
 
virtual bool getImporting ()=0
 Get importing. More...
 
virtual void setNetworkActive (bool active)=0
 Set network active. More...
 
virtual bool getNetworkActive ()=0
 Get network active. More...
 
virtual CAmount getMaxTxFee ()=0
 Get max tx fee. More...
 
virtual CFeeRate estimateSmartFee (int num_blocks, bool conservative, int *returned_target=nullptr)=0
 Estimate smart fee. More...
 
virtual CFeeRate getDustRelayFee ()=0
 Get dust relay fee. More...
 
virtual UniValue executeRpc (const std::string &command, const UniValue &params, const std::string &uri)=0
 Execute rpc command. More...
 
virtual std::vector< std::string > listRpcCommands ()=0
 List rpc commands. More...
 
virtual void rpcSetTimerInterfaceIfUnset (RPCTimerInterface *iface)=0
 Set RPC timer interface if unset. More...
 
virtual void rpcUnsetTimerInterface (RPCTimerInterface *iface)=0
 Unset RPC timer interface. More...
 
virtual bool getUnspentOutput (const COutPoint &output, Coin &coin)=0
 Get unspent outputs associated with a transaction. More...
 
virtual std::string getWalletDir ()=0
 Return default wallet directory. More...
 
virtual std::vector< std::string > listWalletDir ()=0
 Return available wallets in wallet directory. More...
 
virtual std::vector< std::unique_ptr< Wallet > > getWallets ()=0
 Return interfaces for accessing wallets (if any). More...
 
virtual std::unique_ptr< HandlerhandleInitMessage (InitMessageFn fn)=0
 
virtual std::unique_ptr< HandlerhandleMessageBox (MessageBoxFn fn)=0
 
virtual std::unique_ptr< HandlerhandleQuestion (QuestionFn fn)=0
 
virtual std::unique_ptr< HandlerhandleShowProgress (ShowProgressFn fn)=0
 
virtual std::unique_ptr< HandlerhandleLoadWallet (LoadWalletFn fn)=0
 
virtual std::unique_ptr< HandlerhandleNotifyNumConnectionsChanged (NotifyNumConnectionsChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleNotifyNetworkActiveChanged (NotifyNetworkActiveChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleNotifyAlertChanged (NotifyAlertChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleBannedListChanged (BannedListChangedFn fn)=0
 
virtual std::unique_ptr< HandlerhandleNotifyBlockTip (NotifyBlockTipFn fn)=0
 
virtual std::unique_ptr< HandlerhandleNotifyHeaderTip (NotifyHeaderTipFn fn)=0
 

Detailed Description

Top-level interface for a bitcoin node (bsha3d process).

Definition at line 35 of file node.h.

Member Typedef Documentation

◆ BannedListChangedFn

using interfaces::Node::BannedListChangedFn = std::function<void()>

Register handler for ban list messages.

Definition at line 222 of file node.h.

◆ InitMessageFn

using interfaces::Node::InitMessageFn = std::function<void(const std::string& message)>

Register handler for init messages.

Definition at line 186 of file node.h.

◆ LoadWalletFn

using interfaces::Node::LoadWalletFn = std::function<void(std::unique_ptr<Wallet> wallet)>

Register handler for load wallet messages.

Definition at line 206 of file node.h.

◆ MessageBoxFn

using interfaces::Node::MessageBoxFn = std::function<bool(const std::string& message, const std::string& caption, unsigned int style)>

Register handler for message box messages.

Definition at line 191 of file node.h.

◆ NodesStats

using interfaces::Node::NodesStats = std::vector<std::tuple<CNodeStats, bool, CNodeStateStats> >

Get stats for connected nodes.

Definition at line 98 of file node.h.

◆ NotifyAlertChangedFn

using interfaces::Node::NotifyAlertChangedFn = std::function<void()>

Register handler for notify alert messages.

Definition at line 218 of file node.h.

◆ NotifyBlockTipFn

using interfaces::Node::NotifyBlockTipFn = std::function<void(bool initial_download, int height, int64_t block_time, double verification_progress)>

Register handler for block tip messages.

Definition at line 227 of file node.h.

◆ NotifyHeaderTipFn

using interfaces::Node::NotifyHeaderTipFn = std::function<void(bool initial_download, int height, int64_t block_time, double verification_progress)>

Register handler for header tip messages.

Definition at line 232 of file node.h.

◆ NotifyNetworkActiveChangedFn

using interfaces::Node::NotifyNetworkActiveChangedFn = std::function<void(bool network_active)>

Register handler for network active messages.

Definition at line 214 of file node.h.

◆ NotifyNumConnectionsChangedFn

using interfaces::Node::NotifyNumConnectionsChangedFn = std::function<void(int new_num_connections)>

Register handler for number of connections changed messages.

Definition at line 210 of file node.h.

◆ QuestionFn

using interfaces::Node::QuestionFn = std::function<bool(const std::string& message, const std::string& non_interactive_message, const std::string& caption, unsigned int style)>

Register handler for question messages.

Definition at line 198 of file node.h.

◆ ShowProgressFn

using interfaces::Node::ShowProgressFn = std::function<void(const std::string& title, int progress, bool resume_possible)>

Register handler for progress messages.

Definition at line 202 of file node.h.

Constructor & Destructor Documentation

◆ ~Node()

virtual interfaces::Node::~Node ( )
inlinevirtual

Definition at line 38 of file node.h.

Member Function Documentation

◆ appInitMain()

virtual bool interfaces::Node::appInitMain ( )
pure virtual

Start node.

Here is the caller graph for this function:

◆ appShutdown()

virtual void interfaces::Node::appShutdown ( )
pure virtual

Stop node.

Here is the caller graph for this function:

◆ ban()

virtual bool interfaces::Node::ban ( const CNetAddr net_addr,
BanReason  reason,
int64_t  ban_time_offset 
)
pure virtual

Ban node.

Here is the caller graph for this function:

◆ baseInitialize()

virtual bool interfaces::Node::baseInitialize ( )
pure virtual

Initialize app dependencies.

◆ disconnect()

virtual bool interfaces::Node::disconnect ( NodeId  id)
pure virtual

Disconnect node.

Here is the caller graph for this function:

◆ estimateSmartFee()

virtual CFeeRate interfaces::Node::estimateSmartFee ( int  num_blocks,
bool  conservative,
int *  returned_target = nullptr 
)
pure virtual

Estimate smart fee.

◆ executeRpc()

virtual UniValue interfaces::Node::executeRpc ( const std::string &  command,
const UniValue params,
const std::string &  uri 
)
pure virtual

Execute rpc command.

Here is the caller graph for this function:

◆ getBanned()

virtual bool interfaces::Node::getBanned ( banmap_t banmap)
pure virtual

Get ban map entries.

Here is the caller graph for this function:

◆ getDustRelayFee()

virtual CFeeRate interfaces::Node::getDustRelayFee ( )
pure virtual

Get dust relay fee.

Here is the caller graph for this function:

◆ getHeaderTip()

virtual bool interfaces::Node::getHeaderTip ( int &  height,
int64_t &  block_time 
)
pure virtual

Get header tip height and time.

Here is the caller graph for this function:

◆ getImporting()

virtual bool interfaces::Node::getImporting ( )
pure virtual

Get importing.

Here is the caller graph for this function:

◆ getLastBlockTime()

virtual int64_t interfaces::Node::getLastBlockTime ( )
pure virtual

Get last block time.

Here is the caller graph for this function:

◆ getLogCategories()

virtual uint32_t interfaces::Node::getLogCategories ( )
pure virtual

◆ getMaxTxFee()

virtual CAmount interfaces::Node::getMaxTxFee ( )
pure virtual

Get max tx fee.

Here is the caller graph for this function:

◆ getMempoolDynamicUsage()

virtual size_t interfaces::Node::getMempoolDynamicUsage ( )
pure virtual

Get mempool dynamic usage.

Here is the caller graph for this function:

◆ getMempoolSize()

virtual size_t interfaces::Node::getMempoolSize ( )
pure virtual

Get mempool size.

Here is the caller graph for this function:

◆ getNetwork()

virtual std::string interfaces::Node::getNetwork ( )
pure virtual

Get network name.

◆ getNetworkActive()

virtual bool interfaces::Node::getNetworkActive ( )
pure virtual

Get network active.

Here is the caller graph for this function:

◆ getNodeCount()

virtual size_t interfaces::Node::getNodeCount ( CConnman::NumConnections  flags)
pure virtual

Get number of connections.

Here is the caller graph for this function:

◆ getNodesStats()

virtual bool interfaces::Node::getNodesStats ( NodesStats stats)
pure virtual
Here is the caller graph for this function:

◆ getNumBlocks()

virtual int interfaces::Node::getNumBlocks ( )
pure virtual

Get num blocks.

Here is the caller graph for this function:

◆ getProxy()

virtual bool interfaces::Node::getProxy ( Network  net,
proxyType proxy_info 
)
pure virtual

Get proxy.

Here is the caller graph for this function:

◆ getReindex()

virtual bool interfaces::Node::getReindex ( )
pure virtual

Get reindex.

Here is the caller graph for this function:

◆ getTotalBytesRecv()

virtual int64_t interfaces::Node::getTotalBytesRecv ( )
pure virtual

Get total bytes recv.

Here is the caller graph for this function:

◆ getTotalBytesSent()

virtual int64_t interfaces::Node::getTotalBytesSent ( )
pure virtual

Get total bytes sent.

Here is the caller graph for this function:

◆ getUnspentOutput()

virtual bool interfaces::Node::getUnspentOutput ( const COutPoint output,
Coin coin 
)
pure virtual

Get unspent outputs associated with a transaction.

◆ getVerificationProgress()

virtual double interfaces::Node::getVerificationProgress ( )
pure virtual

Get verification progress.

Here is the caller graph for this function:

◆ getWalletDir()

virtual std::string interfaces::Node::getWalletDir ( )
pure virtual

Return default wallet directory.

◆ getWallets()

virtual std::vector<std::unique_ptr<Wallet> > interfaces::Node::getWallets ( )
pure virtual

Return interfaces for accessing wallets (if any).

Here is the caller graph for this function:

◆ getWarnings()

virtual std::string interfaces::Node::getWarnings ( const std::string &  type)
pure virtual

Get warnings.

Here is the caller graph for this function:

◆ handleBannedListChanged()

virtual std::unique_ptr<Handler> interfaces::Node::handleBannedListChanged ( BannedListChangedFn  fn)
pure virtual

◆ handleInitMessage()

virtual std::unique_ptr<Handler> interfaces::Node::handleInitMessage ( InitMessageFn  fn)
pure virtual
Here is the caller graph for this function:

◆ handleLoadWallet()

virtual std::unique_ptr<Handler> interfaces::Node::handleLoadWallet ( LoadWalletFn  fn)
pure virtual
Here is the caller graph for this function:

◆ handleMessageBox()

virtual std::unique_ptr<Handler> interfaces::Node::handleMessageBox ( MessageBoxFn  fn)
pure virtual
Here is the caller graph for this function:

◆ handleNotifyAlertChanged()

virtual std::unique_ptr<Handler> interfaces::Node::handleNotifyAlertChanged ( NotifyAlertChangedFn  fn)
pure virtual

◆ handleNotifyBlockTip()

virtual std::unique_ptr<Handler> interfaces::Node::handleNotifyBlockTip ( NotifyBlockTipFn  fn)
pure virtual

◆ handleNotifyHeaderTip()

virtual std::unique_ptr<Handler> interfaces::Node::handleNotifyHeaderTip ( NotifyHeaderTipFn  fn)
pure virtual

◆ handleNotifyNetworkActiveChanged()

virtual std::unique_ptr<Handler> interfaces::Node::handleNotifyNetworkActiveChanged ( NotifyNetworkActiveChangedFn  fn)
pure virtual

◆ handleNotifyNumConnectionsChanged()

virtual std::unique_ptr<Handler> interfaces::Node::handleNotifyNumConnectionsChanged ( NotifyNumConnectionsChangedFn  fn)
pure virtual

◆ handleQuestion()

virtual std::unique_ptr<Handler> interfaces::Node::handleQuestion ( QuestionFn  fn)
pure virtual

◆ handleShowProgress()

virtual std::unique_ptr<Handler> interfaces::Node::handleShowProgress ( ShowProgressFn  fn)
pure virtual
Here is the caller graph for this function:

◆ initLogging()

virtual void interfaces::Node::initLogging ( )
pure virtual

Init logging.

Here is the caller graph for this function:

◆ initParameterInteraction()

virtual void interfaces::Node::initParameterInteraction ( )
pure virtual

Init parameter interaction.

Here is the caller graph for this function:

◆ isInitialBlockDownload()

virtual bool interfaces::Node::isInitialBlockDownload ( )
pure virtual

Is initial block download.

Here is the caller graph for this function:

◆ listRpcCommands()

virtual std::vector<std::string> interfaces::Node::listRpcCommands ( )
pure virtual

List rpc commands.

Here is the caller graph for this function:

◆ listWalletDir()

virtual std::vector<std::string> interfaces::Node::listWalletDir ( )
pure virtual

Return available wallets in wallet directory.

◆ mapPort()

virtual void interfaces::Node::mapPort ( bool  use_upnp)
pure virtual

Map port.

Here is the caller graph for this function:

◆ parseParameters()

virtual bool interfaces::Node::parseParameters ( int  argc,
const char *const  argv[],
std::string &  error 
)
pure virtual

Set command line arguments.

◆ readConfigFiles()

virtual bool interfaces::Node::readConfigFiles ( std::string &  error)
pure virtual

Load settings from configuration file.

◆ rpcSetTimerInterfaceIfUnset()

virtual void interfaces::Node::rpcSetTimerInterfaceIfUnset ( RPCTimerInterface iface)
pure virtual

Set RPC timer interface if unset.

Here is the caller graph for this function:

◆ rpcUnsetTimerInterface()

virtual void interfaces::Node::rpcUnsetTimerInterface ( RPCTimerInterface iface)
pure virtual

Unset RPC timer interface.

Here is the caller graph for this function:

◆ selectParams()

virtual void interfaces::Node::selectParams ( const std::string &  network)
pure virtual

Choose network parameters.

◆ setNetworkActive()

virtual void interfaces::Node::setNetworkActive ( bool  active)
pure virtual

Set network active.

Here is the caller graph for this function:

◆ setupServerArgs()

virtual void interfaces::Node::setupServerArgs ( )
pure virtual

Setup arguments.

◆ shutdownRequested()

virtual bool interfaces::Node::shutdownRequested ( )
pure virtual

Return whether shutdown was requested.

Here is the caller graph for this function:

◆ softSetArg()

virtual bool interfaces::Node::softSetArg ( const std::string &  arg,
const std::string &  value 
)
pure virtual

Set a command line argument if it doesn't already have a value.

Here is the caller graph for this function:

◆ softSetBoolArg()

virtual bool interfaces::Node::softSetBoolArg ( const std::string &  arg,
bool  value 
)
pure virtual

Set a command line boolean argument if it doesn't already have a value.

◆ startShutdown()

virtual void interfaces::Node::startShutdown ( )
pure virtual

Start shutdown.

Here is the caller graph for this function:

◆ unban()

virtual bool interfaces::Node::unban ( const CSubNet ip)
pure virtual

Unban node.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: