Beispiel #1
0
 public bool CommitBlock(Block block)
 {
     if (block.IsValidBlock(blocks[blocks.Count - 1]))
     {
         foreach (NormalTransaction tx in block.transactions)
         {
             if (!transactions.Contains(tx))
             {
                 return(false);
             }
             //if any transactions are not in the waiting pool, there must be someone commiting it first
         }
         foreach (NormalTransaction tx in block.transactions)
         {
             transactions.Remove(tx);
         }
         blocks.Add(block);
         return(true);
     }
     else
     {
         return(false);
     }
 }