コード例 #1
0
        public bool TryFind(Keccak transactionHash, out TransactionReceipt receipt)
        {
            var id = transactionHash.AsDocumentId();

            if (!TryFetchData(id, out var deltaHash, out var delta))
            {
                receipt = default;
                return(false);
            }

            var index = 0;

            foreach (var publicEntry in delta.PublicEntries)
            {
                var documentId = publicEntry.GetDocumentId(_hashProvider);
                if (id == documentId)
                {
                    var key = GetDocumentId(deltaHash);
                    if (_repository.TryGet(key, out var receipts))
                    {
                        receipt = receipts.Receipts[index];
                        return(true);
                    }

                    receipt = default;
                    return(false);
                }

                index++;
            }

            receipt = default;
            return(false);
        }
コード例 #2
0
        public bool TryFind(Keccak transactionHash, out Cid deltaHash, out Delta delta, out int index)
        {
            var id = transactionHash.AsDocumentId();

            if (!TryFetchData(id, out deltaHash, out delta))
            {
                index = 0;
                return(false);
            }

            index = 0;
            foreach (var pe in delta.PublicEntries)
            {
                var documentId = pe.GetDocumentId(_hashProvider);
                if (id == documentId)
                {
                    return(true);
                }

                index++;
            }

            return(false);
        }