public void PushEntry(WalletEntry entry, BlockType? blockType) { if(blockType == null && entry.Block != null) throw new ArgumentException("An entry coming from a block should have a blocktype"); Unconfirmed.PushEntry(entry); if(entry.Type == WalletEntryType.Outcome) Available.PushEntry(entry); if(entry.Block != null && blockType == BlockType.Main) { Available.PushEntry(entry); Confirmed.PushEntry(entry); } }
internal void PushEntry(WalletEntry entry) { if (entry.Type == WalletEntryType.Income) { var spendable = entry.GetSpendable(); PushAccountEntry(entry.Block, spendable, spendable.TxOut.Value); } else if (entry.Type == WalletEntryType.Outcome) { if (_Unspent.ContainsKey(entry.OutPoint)) { var spendable = _Unspent[entry.OutPoint]; PushAccountEntry(entry.Block, spendable, -spendable.TxOut.Value); } } }
public void PushEntry(WalletEntry entry, BlockType?blockType) { if (blockType == null && entry.Block != null) { throw new ArgumentException("An entry coming from a block should have a blocktype"); } Unconfirmed.PushEntry(entry); if (entry.Type == WalletEntryType.Outcome) { Available.PushEntry(entry); } if (entry.Block != null && blockType == BlockType.Main) { Available.PushEntry(entry); Confirmed.PushEntry(entry); } }
private void ReceiveTransaction(uint256 block, BlockType?blockType, Transaction tx) { var oldBalance = Balance; var txHash = tx.GetHash(); for (int i = 0; i < tx.Outputs.Count; i++) { foreach (var key in _Keys) { if (tx.Outputs[i].IsTo(key.PubKey)) { var entry = new WalletEntry(); entry.Block = block; entry.ScriptPubKey = tx.Outputs[i].ScriptPubKey; entry.OutPoint = new OutPoint(tx, i); entry.Value = tx.Outputs[i].Value; _Accounts.PushEntry(entry, blockType); } } } foreach (var txin in tx.Inputs) { foreach (var key in _Keys) { if (txin.IsFrom(key.PubKey)) { var entry = new WalletEntry(); entry.Block = block; entry.OutPoint = txin.PrevOut; _Accounts.PushEntry(entry, blockType); } } } OnBalanceChanged(tx, oldBalance, Balance); }
private void ReceiveTransaction(uint256 block, BlockType? blockType, Transaction tx) { var oldBalance = Balance; var txHash = tx.GetHash(); for(int i = 0 ; i < tx.Outputs.Count ; i++) { foreach(var key in _Keys) { if(tx.Outputs[i].IsTo(key.PubKey)) { var entry = new WalletEntry(); entry.Block = block; entry.ScriptPubKey = tx.Outputs[i].ScriptPubKey; entry.OutPoint = new OutPoint(tx, i); entry.Value = tx.Outputs[i].Value; _Accounts.PushEntry(entry, blockType); } } } foreach(var txin in tx.Inputs) { foreach(var key in _Keys) { if(txin.IsFrom(key.PubKey)) { var entry = new WalletEntry(); entry.Block = block; entry.OutPoint = txin.PrevOut; _Accounts.PushEntry(entry, blockType); } } } OnBalanceChanged(tx, oldBalance, Balance); }
internal void PushEntry(WalletEntry entry) { if(entry.Type == WalletEntryType.Income) { var spendable = entry.GetSpendable(); PushAccountEntry(entry.Block, spendable, spendable.TxOut.Value); } else if(entry.Type == WalletEntryType.Outcome) { if(_Unspent.ContainsKey(entry.OutPoint)) { var spendable = _Unspent[entry.OutPoint]; PushAccountEntry(entry.Block, spendable, -spendable.TxOut.Value); } } }