コード例 #1
0
 private void CheckCommits()
 {
     if (context.CommitPayloads.Count(p => p?.ConsensusMessage.ViewNumber == context.ViewNumber) >= context.M && context.TransactionHashes.All(p => context.Transactions.ContainsKey(p)))
     {
         Block block = context.CreateBlock();
         Log($"relay block: height={block.Index} hash={block.Hash} tx={block.Transactions.Length}");
         blockchain.Tell(block);
     }
 }
コード例 #2
0
 private void CheckCommits()
 {
     if (context.CommitPayloads.Count(p => context.GetMessage(p)?.ViewNumber == context.ViewNumber) >= context.M && context.TransactionHashes.All(p => context.Transactions.ContainsKey(p)))
     {
         block_received_index = context.Block.Index;
         block_received_time  = TimeProvider.Current.UtcNow;
         Block block = context.CreateBlock();
         Log($"Sending {nameof(Block)}: height={block.Index} hash={block.Hash} tx={block.Transactions.Length}");
         blockchain.Tell(block);
     }
 }
コード例 #3
0
ファイル: ConsensusService.cs プロジェクト: yujiye/neo
 private void CheckSignatures()
 {
     if (context.Signatures.Count(p => p != null) >= context.M && context.TransactionHashes.All(p => context.Transactions.ContainsKey(p)))
     {
         Block block = context.CreateBlock();
         Log($"relay block: {block.Hash}");
         system.LocalNode.Tell(new LocalNode.Relay {
             Inventory = block
         });
         context.State |= ConsensusState.BlockSent;
     }
 }