/// <summary> /// Initializes a GetTxOutModel instance. /// </summary> /// <param name="unspentOutputs">The <see cref="UnspentOutputs"/>.</param> /// <param name="vout">The output index.</param> /// <param name="network">The network the transaction occurred on.</param> /// <param name="tip">The current consensus tip's <see cref="ChainedHeader"/>.</param> public GetTxOutModel(UnspentOutputs unspentOutputs, uint vout, Network network, ChainedHeader tip) { if (unspentOutputs != null) { TxOut output = unspentOutputs.TryGetOutput(vout); this.BestBlock = tip.HashBlock; this.Coinbase = unspentOutputs.IsCoinbase; this.Confirmations = NetworkExtensions.MempoolHeight == unspentOutputs.Height ? 0 : tip.Height - (int)unspentOutputs.Height + 1; if (output != null) { this.Value = output.Value; this.ScriptPubKey = new ScriptPubKey(output.ScriptPubKey, network); } } }
public GetTxOutModel(UnspentOutputs unspentOutputs, uint vout, Network network, ChainedBlock tip) { if (unspentOutputs != null) { var output = unspentOutputs.TryGetOutput(vout); this.bestblock = tip.HashBlock; this.coinbase = unspentOutputs.IsCoinbase; this.confirmations = TxMempool.MempoolHeight == unspentOutputs.Height ? 0 : tip.Height - (int)unspentOutputs.Height + 1; if (output != null) { this.value = output.Value; this.scriptPubKey = new ScriptPubKey(output.ScriptPubKey, network); } } }