Exemple #1
0
 public void AddRequest(BlockConsensusRequest request, MinerWallet wallet)
 {
     lock (SyncRoot)
     {
         if (request.PrevHash != PrevHash)
         {
             return;
         }
         if (request.Miner == my_pubkey)
         {
             return;
         }
         if (NoncePieces.ContainsKey(request.Miner))
         {
             return;
         }
         byte[] aeskey = wallet.GetAesKey(request.Miner);
         byte[] piece  = request.NoncePieces[my_pubkey];
         using (AesManaged aes = new AesManaged())
             using (ICryptoTransform decryptor = aes.CreateDecryptor(aeskey, request.IV))
             {
                 piece = decryptor.TransformFinalBlock(piece, 0, piece.Length);
             }
         Array.Clear(aeskey, 0, aeskey.Length);
         NoncePieces.Add(request.Miner, new List <FiniteFieldPoint>());
         NoncePieces[request.Miner].Add(FiniteFieldPoint.DeserializeFrom(piece));
         NonceHashes.Add(request.Miner, request.NonceHash);
         TransactionHashes.UnionWith(request.TransactionHashes);
         action_request.CheckPredicate();
     }
 }