예제 #1
0
 private PeerToPeerCommand QueryAllBlocks()
 {
     try
     {
         var     allBlocks        = _blockService.GetAllBlocks();
         var     allBlockContents = _blockService.GetAllBlockContents();
         Message message          = new PeerToPeerMessage(MessageType.RESPONSE_BLOCKCHAIN, allBlocks, PrepareGraphData(allBlockContents));
         return(new PeerToPeerCommand(CommandType.WRITE, message));
     }
     catch (ReadingBlockException ex)
     {
         _logger.LogDebug("Exception was thrown: ", ex);
         Message errorMessage = new ErrorMessage(ex.Message);
         return(new PeerToPeerCommand(CommandType.WRITE_ERROR, errorMessage));
     }
 }