Commit 59fe1daa authored by Sergei Zubov's avatar Sergei Zubov

Merge UnspentOutputSet

parent a8839265
...@@ -8,7 +8,7 @@ namespace Stratis.Bitcoin.Features.Consensus ...@@ -8,7 +8,7 @@ namespace Stratis.Bitcoin.Features.Consensus
{ {
public class UnspentOutputSet public class UnspentOutputSet
{ {
private Dictionary<uint256, UnspentOutputs> unspents; protected Dictionary<uint256, UnspentOutputs> unspents;
public TxOut GetOutputFor(TxIn txIn) public TxOut GetOutputFor(TxIn txIn)
{ {
...@@ -19,7 +19,7 @@ namespace Stratis.Bitcoin.Features.Consensus ...@@ -19,7 +19,7 @@ namespace Stratis.Bitcoin.Features.Consensus
return unspent.TryGetOutput(txIn.PrevOut.N); return unspent.TryGetOutput(txIn.PrevOut.N);
} }
public bool HaveInputs(Transaction tx) public virtual bool HaveInputs(Transaction tx)
{ {
return tx.Inputs.All(txin => this.GetOutputFor(txin) != null); return tx.Inputs.All(txin => this.GetOutputFor(txin) != null);
} }
...@@ -29,7 +29,7 @@ namespace Stratis.Bitcoin.Features.Consensus ...@@ -29,7 +29,7 @@ namespace Stratis.Bitcoin.Features.Consensus
return this.unspents.TryGet(uint256); return this.unspents.TryGet(uint256);
} }
public Money GetValueIn(Transaction tx) public virtual Money GetValueIn(Transaction tx)
{ {
return tx.Inputs.Select(txin => this.GetOutputFor(txin).Value).Sum(); return tx.Inputs.Select(txin => this.GetOutputFor(txin).Value).Sum();
} }
...@@ -39,7 +39,7 @@ namespace Stratis.Bitcoin.Features.Consensus ...@@ -39,7 +39,7 @@ namespace Stratis.Bitcoin.Features.Consensus
/// </summary> /// </summary>
/// <param name="transaction">Transaction which inputs and outputs are used for updating unspent coins list.</param> /// <param name="transaction">Transaction which inputs and outputs are used for updating unspent coins list.</param>
/// <param name="height">Height of a block that contains target transaction.</param> /// <param name="height">Height of a block that contains target transaction.</param>
public void Update(Transaction transaction, int height) public virtual void Update(Transaction transaction, int height)
{ {
if (!transaction.IsCoinBase) if (!transaction.IsCoinBase)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment