From 497e5c870c2f3d0e99669db2cc71eee114401c1d Mon Sep 17 00:00:00 2001 From: Liuhaai Date: Mon, 30 Sep 2024 10:04:46 -0700 Subject: [PATCH] recipient validation --- action/transfer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action/transfer.go b/action/transfer.go index 1d77eff5f6..b62427fa97 100644 --- a/action/transfer.go +++ b/action/transfer.go @@ -133,6 +133,10 @@ func (tsf *Transfer) SanityCheck() error { if tsf.Amount().Sign() < 0 { return ErrNegativeValue } + // check if recipient's address is valid + if _, err := address.FromString(tsf.recipient); err != nil { + return errors.Wrapf(err, "error when validating contract's address %s", tsf.recipient) + } return nil }