예제 #1
0
 public BlockChainObserver(Executor executor, WebSocketHandler webSocketHandler)
 {
     executor_         = executor;
     webSocketHandler_ = webSocketHandler;
     blockHandler_     = new Executor.BlockHandler(OnBlockReceived);
     txHandler_        = new Executor.TransactionHandler(OnTransactionReceived);
     executor.SubscribeToBlockChain(blockHandler_);
     executor.SubscribeToTransaction(txHandler_);
 }
예제 #2
0
        public BlockChainObserver(Executor executor, WebSocketHandler webSocketHandler, NodeConfig config, ILogger <BlockChainObserver> logger)
        {
            executor_         = executor;
            chain_            = executor.Chain;
            webSocketHandler_ = webSocketHandler;
            config_           = config;
            logger_           = logger;

            if (config_.WebsocketsMsgBlockEnabled)
            {
                blockHandler_ = new Executor.BlockHandler(OnBlockReceived);
                executor.SubscribeToBlockChain(blockHandler_);
            }

            if (config_.WebsocketsMsgTxEnabled || config_.WebsocketsMsgAddressTxEnabled)
            {
                txHandler_ = new Executor.TransactionHandler(OnTransactionReceived);
                executor.SubscribeToTransaction(txHandler_);
            }
        }