/// <summary> /// /// </summary> /// <param name="transaction"></param> public void ProcessTransaction(Transaction transaction) { transaction.RunHash(); transactionPool.AddTransaction(transaction); // send on network if (client != null) { client.Send(transaction.Serialise()); } }
/// <summary> /// Set client from server /// </summary> /// <param name="e"></param> private void SetClientFromServer(ClientFromServerEventArgs e) { client.client = e.client; Task clientConnection = Task.Run(() => client.StartReceiving()); // Send current Hash on network client.Send($"U:{lewCoins.GetLatestBlock().hash},{lewCoins.GetLatestBlock().index}"); }
/// <summary> /// /// </summary> public void MineBlock() { candidateBlock = new Block(DateTime.Now, "", transactionPool.pendingTransactions); candidateBlock.previousHash = currentHash; candidateBlock.index = currentIndex; // This will block the thread in future when we make hashing take purposely longer candidateBlock.MineHash("Lew"); // Candidate block complete, send on network client.Send(candidateBlock.Serialise()); }