コード例 #1
0
        public AccountId CreatedAccount()
        {
            AccountId destination      = null;
            Hash256   destinationIndex = null;

            if (TransactionType == TransactionType.Payment && Meta.Has(Field.AffectedNodes))
            {
                StArray affected = Meta[StArray.AffectedNodes];

                foreach (var node in affected)
                {
                    if (node.Has(StObject.CreatedNode))
                    {
                        StObject created = node[StObject.CreatedNode];

                        if (StObject.LedgerEntryType(created) == LedgerEntryType.AccountRoot)
                        {
                            if (destination == null)
                            {
                                destination      = Txn[AccountId.Destination];
                                destinationIndex = Hash256.AccountIdLedgerIndex(destination);
                            }

                            if (destinationIndex.Equals(created[Hash256.LedgerHash]))
                            {
                                return(destination);
                            }
                        }
                    }
                }
            }

            return(null);
        }
コード例 #2
0
        public IDictionary <AccountId, StObject> ModifiedRoots()
        {
            Dictionary <AccountId, StObject> accounts = null;

            if (Meta.Has(Field.AffectedNodes))
            {
                accounts = new Dictionary <AccountId, StObject>();

                StArray affected = Meta[StArray.AffectedNodes];
                foreach (var node in affected)
                {
                    if (node.Has(Field.ModifiedNode))
                    {
                        var localNode = node[StObject.ModifiedNode];
                        if (StObject.LedgerEntryType(localNode) == LedgerEntryType.AccountRoot)
                        {
                            StObject  finalFields = localNode[StObject.FinalFields];
                            AccountId key;

                            if (finalFields != null)
                            {
                                key = finalFields[AccountId.Account];
                                accounts.Add(key, localNode);
                            }
                            else
                            {
                                // TODO why the hell is this commented out

                                // key = initiatingAccount();
                                // Hash256 index = Hash256.accountIDLedgerIndex(key);
                                // if (index.equals(node.get(Hash256.LedgerIndex))) {
                                //     accounts.put(key, node);
                                // }
                            }
                        }
                    }
                }
            }

            return(accounts);
        }