コード例 #1
0
def add(
    dispatcher,
    thread_pool,
    consensus_proxy,
    consensus_notifier,
):

    handler = handlers.ConsensusRegisterHandler(consensus_proxy,
                                                consensus_notifier)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusRegisterBlockNewSyncHandler(
        consensus_proxy, consensus_notifier)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusSendToHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusBroadcastHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusInitializeBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusSummarizeBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusFinalizeBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusCancelBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusCheckBlocksHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusCheckBlocksNotifier(consensus_proxy,
                                                    consensus_notifier)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusCommitBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusIgnoreBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusFailBlockHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusBlocksGetHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusChainHeadGetHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusSettingsGetHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)

    handler = handlers.ConsensusStateGetHandler(consensus_proxy)
    dispatcher.add_handler(handler.request_type, handler, thread_pool)
コード例 #2
0
ファイル: tests.py プロジェクト: bestonly125/DGT-Kawartha
 def test_consensus_summarize_block_handler(self):
     self.mock_proxy.summarize_block.return_value = b"1234"
     handler = handlers.ConsensusSummarizeBlockHandler(self.mock_proxy)
     request_class = handler.request_class
     request = request_class()
     result = handler.handle(None, request.SerializeToString())
     response = result.message_out
     self.assertEqual(response.status, handler.response_class.OK)
     self.mock_proxy.summarize_block.assert_called_with()