private void CheckCandidates(IHashCandidate candidate) { try { // get the transaction. var transaction = _daemonClient.GetTransaction(candidate.TransactionHash); // total amount of coins contained in the block. candidate.Amount = transaction.Details.Sum(output => (decimal)output.Amount); // get the output transaction that targets pools central wallet. var poolOutput = transaction.Details.FirstOrDefault(output => output.Address == _walletConfig.Adress); // make sure output for the pool central wallet exists if (poolOutput == null) { candidate.Status = BlockStatus.Kicked; // kick the hash. candidate.Reward = 0; } else { switch (poolOutput.Category) { case "immature": candidate.Status = BlockStatus.Pending; break; case "orphan": candidate.Status = BlockStatus.Orphaned; break; case "generate": candidate.Status = BlockStatus.Confirmed; break; default: candidate.Status = BlockStatus.Pending; break; } candidate.Reward = (decimal) poolOutput.Amount; } } catch (RpcException) { candidate.Status = BlockStatus.Kicked; // kick the hash. candidate.Reward = 0; } }
public KickedBlock(uint height, IHashCandidate candidate) : this(height, candidate.BlockHash, candidate.TransactionHash, candidate.Amount, candidate.Reward) { }
public void AddHashCandidate(IHashCandidate hash) { Candidates.Add(hash); }