MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / validate

Method validate

model/model.go:412–417  ·  view source on GitHub ↗

validate checks if the transaction is valid (e.g., ensuring positive amount).

()

Source from the content-addressed store, hash-verified

410
411// validate checks if the transaction is valid (e.g., ensuring positive amount).
412func (transaction *Transaction) validate() error {
413 if transaction.Amount <= 0 && transaction.PreciseAmount == nil {
414 return errors.New("transaction amount must be positive")
415 }
416 return nil
417}
418
419// UpdateBalances updates the balances for both the source and destination based on the transaction details.
420// It ensures precision is applied and checks for overdraft before updating.

Callers 2

TestTransaction_ValidateFunction · 0.95
UpdateBalancesFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestTransaction_ValidateFunction · 0.76