pub struct BitcoinNode {
pub blockchain: Arc<BlockchainService>,
pub mempool: Arc<MempoolService>,
pub mining: Arc<MiningService>,
pub rpc_server: Arc<JsonRpcServer>,
pub peer_manager: Arc<dyn PeerManager>,
pub mempool_adapter: Arc<InMemoryMempool>,
pub block_index: Arc<RwLock<BlockIndex>>,
pub sync_manager: Arc<RwLock<SyncManager>>,
pub fee_estimator: Arc<RwLock<FeeEstimator>>,
pub rebroadcast_manager: Arc<RwLock<RebroadcastManager>>,
pub wallet: Option<Arc<dyn WalletPort>>,
/* private fields */
}Expand description
Application state containing all services and ports
Fields§
§blockchain: Arc<BlockchainService>§mempool: Arc<MempoolService>§mining: Arc<MiningService>§rpc_server: Arc<JsonRpcServer>§peer_manager: Arc<dyn PeerManager>§mempool_adapter: Arc<InMemoryMempool>§block_index: Arc<RwLock<BlockIndex>>§sync_manager: Arc<RwLock<SyncManager>>§fee_estimator: Arc<RwLock<FeeEstimator>>Fee estimator — updated every time a block is connected
rebroadcast_manager: Arc<RwLock<RebroadcastManager>>Rebroadcast manager — tracks wallet txs for periodic re-announcement
wallet: Option<Arc<dyn WalletPort>>Wallet (optional — only when enable_wallet is true)
Implementations§
Source§impl BitcoinNode
impl BitcoinNode
Sourcepub async fn new(args: CliArgs) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn new(args: CliArgs) -> Result<Self, Box<dyn Error + Send + Sync>>
Create and wire all components
Sourcepub async fn handle_peer_event(
&self,
event: PeerEvent,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn handle_peer_event( &self, event: PeerEvent, ) -> Result<(), Box<dyn Error + Send + Sync>>
Process a peer event through the sync manager.
This is the main entry point for handling P2P messages. It delegates to the SyncManager, which returns a list of actions to execute.
Sourcepub async fn stop(&self) -> Result<(), Box<dyn Error + Send + Sync>>
pub async fn stop(&self) -> Result<(), Box<dyn Error + Send + Sync>>
Stop the Bitcoin node gracefully.
Sends the shutdown signal to all background tasks, stops the RPC server, disconnects all peers, and logs the final state.
Sourcepub async fn health(&self) -> NodeHealth
pub async fn health(&self) -> NodeHealth
Get current node health status.
Sourcepub async fn get_chain_info(&self) -> Result<ChainInfo, String>
pub async fn get_chain_info(&self) -> Result<ChainInfo, String>
Get chain info
Auto Trait Implementations§
impl Freeze for BitcoinNode
impl !RefUnwindSafe for BitcoinNode
impl Send for BitcoinNode
impl Sync for BitcoinNode
impl Unpin for BitcoinNode
impl UnsafeUnpin for BitcoinNode
impl !UnwindSafe for BitcoinNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more