BlockChain: Make PendingTransactions public.
This commit is contained in:
@@ -6,7 +6,7 @@ namespace BasicBlockChain.Core
|
||||
{
|
||||
public class BlockChain
|
||||
{
|
||||
private List<Transaction> _pendingTransactions = new List<Transaction>();
|
||||
public List<Transaction> PendingTransactions { get; } = new List<Transaction>();
|
||||
public List<Block> Chain { get; } = new List<Block>();
|
||||
public int Difficulty { get; set; } = 2;
|
||||
public int Reward { get; set; } = 1_000_000;
|
||||
@@ -30,17 +30,17 @@ namespace BasicBlockChain.Core
|
||||
|
||||
public void AddTransaction(Transaction transaction)
|
||||
{
|
||||
_pendingTransactions.Add(transaction);
|
||||
PendingTransactions.Add(transaction);
|
||||
}
|
||||
|
||||
public void ProcessPendingTransactions(DateTime date, string miner)
|
||||
{
|
||||
Block lastBlock = Chain.Last();
|
||||
Block newBlock = new Block(date, lastBlock, _pendingTransactions);
|
||||
Block newBlock = new Block(date, lastBlock, PendingTransactions);
|
||||
newBlock.Transactions.Add(new Transaction(null, miner, Reward, date));
|
||||
newBlock.Mine(Difficulty);
|
||||
Chain.Add(newBlock);
|
||||
_pendingTransactions.Clear();
|
||||
PendingTransactions.Clear();
|
||||
}
|
||||
|
||||
public bool Verify()
|
||||
|
||||
Reference in New Issue
Block a user