コード例 #1
0
 private bool MatchInContext(TransactionDeclarationContext context, List <TransactionDeclarationEntity> declarations, TxDeclaration declaration, TransactionHash hash, int index)
 {
     foreach (var entity in declarations)
     {
         if (entity.TransactionHash.Equals(hash) && entity.Index == index)
         {
             context.TryAdd(entity, declaration);
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
        private TransactionDeclarationContext CreateDeclarationContext(SignedLedger signed, List <TransactionDeclarationEntity> declarations)
        {
            var context = new TransactionDeclarationContext();

            foreach (var transaction in signed.Ledger.Block.Transactions)
            {
                var index = 0;
                foreach (var declaration in transaction.Transaction.Declarations)
                {
                    if (!MatchInContext(context, declarations, declaration, transaction.Hash, index++))
                    {
                        throw new NotImplementedException("It should match");
                    }
                }
            }
            return(context);
        }