Documentation
¶
Overview ¶
Package metadata provides test helpers for validating transaction metadata. Ported from rippled test helpers (Discrepancy_test.cpp, Freeze_test.cpp, etc.).
Index ¶
- func CheckNodeCount(t *testing.T, result jtx.TxResult, expected int)
- func CheckXRPConservation(t *testing.T, result jtx.TxResult, fee uint64)
- func FindNode(meta *tx.Metadata, nodeType, entryType string) *tx.AffectedNode
- func FindNodeByAccount(meta *tx.Metadata, account string) *tx.AffectedNode
- func FindNodes(meta *tx.Metadata, nodeType, entryType string) []*tx.AffectedNode
- func GetFinalField(node *tx.AffectedNode, field string) any
- func GetNewField(node *tx.AffectedNode, field string) any
- func GetPreviousField(node *tx.AffectedNode, field string) any
- func ToUint32(v any) uint32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckNodeCount ¶
CheckNodeCount verifies the number of AffectedNodes in metadata.
func CheckXRPConservation ¶
CheckXRPConservation verifies that XRP is conserved across a transaction's metadata. For every AccountRoot in AffectedNodes, sums the previous and final Balance values. Verifies: sumPrev - sumFinal == fee (XRP destroyed equals the fee). Ported from rippled's Discrepancy_test.cpp testXRPDiscrepancy().
func FindNode ¶
func FindNode(meta *tx.Metadata, nodeType, entryType string) *tx.AffectedNode
FindNode finds the first AffectedNode matching the given type and entry type.
func FindNodeByAccount ¶
func FindNodeByAccount(meta *tx.Metadata, account string) *tx.AffectedNode
FindNodeByAccount finds the first ModifiedNode AccountRoot for a specific account.
func FindNodes ¶
func FindNodes(meta *tx.Metadata, nodeType, entryType string) []*tx.AffectedNode
FindNodes finds all AffectedNodes matching the given type and entry type.
func GetFinalField ¶
func GetFinalField(node *tx.AffectedNode, field string) any
GetFinalField extracts a field from FinalFields of an AffectedNode.
func GetNewField ¶
func GetNewField(node *tx.AffectedNode, field string) any
GetNewField extracts a field from NewFields of an AffectedNode.
func GetPreviousField ¶
func GetPreviousField(node *tx.AffectedNode, field string) any
GetPreviousField extracts a field from PreviousFields of an AffectedNode.
Types ¶
This section is empty.