public static void SetMinersTrue(string ip, long blockID) { int minerIndex = FindIndexOfGivenInput(ip); var keyValuePair = GetBlockInProcessingBlock(blockID); int blockIndex = keyValuePair.Key; Block block = keyValuePair.Value; if (block == null) { return; } if (miners[minerIndex][blockIndex].Key.BlockID == block.BlockID) { miners[minerIndex].RemoveAt(blockIndex); miners[minerIndex].Add(new KeyValuePair <Block, bool>(block, true)); BlockChain.TryToAddChain(block); } }
public static void UpdateProcessingBlockList(Block block) { int myIndex = FindIndexOfGivenInput(TCP.myIP); var keyValuePair = GetBlockInProcessingBlock(block.BlockID); int blockIndex = keyValuePair.Key; Block processingBlock = keyValuePair.Value; if (processingBlock == null) { return; } if (miners[myIndex][blockIndex].Key.Time.CompareTo(block.Time) >= 0) { miners[myIndex].RemoveAt(blockIndex); processingBlock.Time = block.Time; processingBlock.Nonce = block.Nonce; processingBlock.Hash = block.Hash; miners[myIndex].Add(new KeyValuePair <Block, bool>(processingBlock, true)); } BlockChain.TryToAddChain(processingBlock); }