Skip to content

Commit

Permalink
fix: handle AffectedNodes edge case in settings.ts (#1907)
Browse files Browse the repository at this point in the history
AffectedNodes may have not only ModifiedNode, but also CreatedNode and DeletedNode.

https://xrpl.org/transaction-metadata.html

Co-authored-by: Mayukha Vadari <mvadari@gmail.com>
  • Loading branch information
lupyang and mvadari committed Feb 10, 2022
1 parent 14089a0 commit 46eb872
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ledger/parse/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const AccountFlags = constants.AccountFlags
import parseFields from './fields'

function getAccountRootModifiedNode(tx: any) {
const modifiedNodes = tx.meta.AffectedNodes.filter(
(node) => node.ModifiedNode.LedgerEntryType === 'AccountRoot'
)
const modifiedNodes = tx.meta.AffectedNodes.filter(node => node.ModifiedNode?.LedgerEntryType === 'AccountRoot');
assert.ok(modifiedNodes.length === 1)
return modifiedNodes[0].ModifiedNode
}
Expand Down

0 comments on commit 46eb872

Please sign in to comment.