From 68233741919029c1c793c2e5f469a953af20afdb Mon Sep 17 00:00:00 2001 From: wincenteam Date: Sun, 16 Jun 2019 05:29:56 +0800 Subject: [PATCH] add check --- internal/ethapi/api_exchange.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/api_exchange.go b/internal/ethapi/api_exchange.go index eb7afde9..490e3824 100644 --- a/internal/ethapi/api_exchange.go +++ b/internal/ethapi/api_exchange.go @@ -89,7 +89,7 @@ func isString(input []byte) bool { type ReceptionArgs struct { Addr hexutil.Bytes - Currency string + Currency Smbol Value *Big } @@ -114,6 +114,9 @@ func (args GenTxArgs) check() error { if err != nil { return err } + if rec.Currency.IsEmpty() { + return errors.Errorf("%v reception currency is nil", hexutil.Encode(rec.Addr[:])) + } if rec.Value == nil { return errors.Errorf("%v reception value is nil", hexutil.Encode(rec.Addr[:])) } @@ -145,7 +148,7 @@ func (args GenTxArgs) toTxParam() exchange.TxParam { pkr := byteToPkr(rec.Addr) receptions = append(receptions, exchange.Reception{ pkr, - rec.Currency, + string(rec.Currency), (*big.Int)(rec.Value), }) }