Beispiel #1
0
        public IEnumerable <uint256> GetMatchedTransactions()
        {
            BitReader  flags  = new BitReader(Flags);
            MerkleNode root   = MerkleNode.GetRoot((int)TransactionCount);
            var        hashes = Hashes.GetEnumerator();

            return(GetMatchedTransactionsCore(root, flags, hashes, false));
        }
Beispiel #2
0
        public MerkleNode GetMerkleRoot()
        {
            MerkleNode node   = MerkleNode.GetRoot((int)TransactionCount);
            BitReader  flags  = new BitReader(Flags);
            var        hashes = Hashes.GetEnumerator();

            GetMatchedTransactionsCore(node, flags, hashes, true).AsEnumerable();
            return(node);
        }
Beispiel #3
0
        public PartialMerkleTree(uint256[] vTxid, bool[] vMatch)
        {
            if (vMatch.Length != vTxid.Length)
            {
                throw new ArgumentException("The size of the array of txid and matches is different");
            }
            TransactionCount = (uint)vTxid.Length;

            MerkleNode root  = MerkleNode.GetRoot(vTxid);
            BitWriter  flags = new BitWriter();

            MarkNodes(root, vMatch);
            BuildCore(root, flags);

            Flags = flags.ToBitArray();
        }
Beispiel #4
0
 public MerkleNode GetMerkleRoot()
 {
     return(MerkleNode.GetRoot(this.Transactions.Select(t => t.GetHash())));
 }