File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2224,6 +2224,28 @@ func (r *rpcServer) AddrReceives(ctx context.Context,
22242224
22252225 var sqlQuery address.EventQueryParams
22262226
2227+ if req .Offset < 0 {
2228+ return nil , fmt .Errorf ("offset must be non-negative" )
2229+ }
2230+ if req .Limit < 0 {
2231+ return nil , fmt .Errorf ("limit must be non-negative" )
2232+ }
2233+
2234+ sqlQuery .Offset = req .Offset
2235+ sqlQuery .Limit = req .Limit
2236+
2237+ switch req .Direction {
2238+ case 0 :
2239+ sqlQuery .SortDirection = address .SortAscending
2240+
2241+ case 1 :
2242+ sqlQuery .SortDirection = address .SortDescending
2243+
2244+ default :
2245+ return nil , fmt .Errorf ("invalid sort direction: %v" ,
2246+ req .Direction )
2247+ }
2248+
22272249 if len (req .FilterAddr ) > 0 {
22282250 addr , err := address .DecodeAddress (
22292251 req .FilterAddr , & r .cfg .ChainParams ,
You can’t perform that action at this time.
0 commit comments