validate checks if the transaction is valid (e.g., ensuring positive amount).
()
| 410 | |
| 411 | // validate checks if the transaction is valid (e.g., ensuring positive amount). |
| 412 | func (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. |
no outgoing calls