/** * Novacoin classes library * Copyright (C) 2015 Alex D. (balthazar.ad@gmail.com) * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Novacoin { public class COutPoint { /// /// Hash of parent transaction. /// public Hash256 hash; /// /// Parent input number. /// public uint n; public COutPoint() { hash = new Hash256(); n = uint.MaxValue; } public COutPoint(Hash256 hashIn, uint nIn) { hash = hashIn; n = nIn; } public COutPoint(COutPoint o) { hash = new Hash256(o.hash); n = o.n; } public COutPoint(IEnumerable bytes) { hash = new Hash256(bytes); n = BitConverter.ToUInt32(bytes.ToArray(), 32); } public bool IsNull { get { return hash.IsZero && n == uint.MaxValue; } } public IList Bytes { get { List r = new List(); r.AddRange(hash.hashBytes); r.AddRange(BitConverter.GetBytes(n)); return r; } } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendFormat("COutPoint({0}, {1})", hash.ToString(), n); return sb.ToString(); } } }