File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,24 @@ package common
1616
1717type UtxoValidationRuleFunc func (Transaction , uint64 , LedgerState , ProtocolParameters ) error
1818
19+ // VerifyTransaction validates a transaction against the given validation rules.
20+ // It runs all provided UtxoValidationRuleFunc functions and returns the first error encountered,
21+ // or nil if all validations pass.
22+ func VerifyTransaction (
23+ tx Transaction ,
24+ slot uint64 ,
25+ ledgerState LedgerState ,
26+ protocolParams ProtocolParameters ,
27+ validationRules []UtxoValidationRuleFunc ,
28+ ) error {
29+ for _ , rule := range validationRules {
30+ if err := rule (tx , slot , ledgerState , protocolParams ); err != nil {
31+ return err
32+ }
33+ }
34+ return nil
35+ }
36+
1937// CalculateMinFee computes the minimum fee for a transaction body given its CBOR-encoded size
2038// and the protocol parameters MinFeeA and MinFeeB
2139func CalculateMinFee (bodySize int , minFeeA uint , minFeeB uint ) uint64 {
You can’t perform that action at this time.
0 commit comments