3838)
3939
4040var (
41- ErrUninitAccessor = errors .New ("accessor is not initialized " )
41+ ErrUninitAccessor = errors .New ("accessor is not initilized " )
4242
4343 // ErrNotSupportedConsensus = errors.New("not supported by this consensus")
4444)
@@ -305,7 +305,7 @@ func (rpc *AergoRPCService) getBlocks(ctx context.Context, in *types.ListParams)
305305 }
306306 }
307307 if in .Asc || in .Offset != 0 {
308- err = errors .New ("has unsupported param" )
308+ err = errors .New ("Has unsupported param" )
309309 }
310310 } else {
311311 end := types .BlockNo (0 )
@@ -564,7 +564,7 @@ func (rpc *AergoRPCService) GetTX(ctx context.Context, in *types.SingleBytes) (*
564564 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
565565 return nil , err
566566 }
567- if len ( in .Value ) == 0 || len ( in . Value ) > maxTxHashLength {
567+ if in .Value == nil {
568568 return nil , status .Errorf (codes .InvalidArgument , "invalid input hash" )
569569 }
570570 result , err := rpc .actorHelper .CallRequestDefaultTimeout (message .MemPoolSvc ,
@@ -589,7 +589,7 @@ func (rpc *AergoRPCService) GetBlockTX(ctx context.Context, in *types.SingleByte
589589 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
590590 return nil , err
591591 }
592- if len ( in .Value ) == 0 || len ( in . Value ) > maxTxHashLength {
592+ if in .Value == nil {
593593 return nil , status .Errorf (codes .InvalidArgument , "invalid input hash" )
594594 }
595595 result , err := rpc .hub .RequestFuture (message .ChainSvc ,
@@ -611,7 +611,7 @@ func (rpc *AergoRPCService) SendTX(ctx context.Context, tx *types.Tx) (*types.Co
611611 if err := rpc .checkAuth (ctx , WriteBlockChain ); err != nil {
612612 return nil , err
613613 }
614- if len ( tx .Hash ) == 0 || len ( tx . Hash ) > maxTxHashLength {
614+ if tx .Hash == nil {
615615 return nil , status .Errorf (codes .InvalidArgument , "invalid tx hash" )
616616 }
617617 if tx .Body == nil {
@@ -686,7 +686,7 @@ func (rpc *AergoRPCService) CommitTX(ctx context.Context, in *types.TxList) (*ty
686686 return nil , status .Errorf (codes .InvalidArgument , "empty transaction" )
687687 }
688688 for _ , tx := range in .Txs {
689- if tx .Body == nil || len (tx .Hash ) == 0 || len ( tx . Hash ) > maxTxHashLength {
689+ if tx .Body == nil || len (tx .Hash ) == 0 {
690690 return nil , status .Errorf (codes .InvalidArgument , "input tx is empty" )
691691 }
692692 }
@@ -707,7 +707,7 @@ func (rpc *AergoRPCService) GetState(ctx context.Context, in *types.SingleBytes)
707707 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
708708 return nil , err
709709 }
710- if len ( in .Value ) == 0 {
710+ if in .Value == nil {
711711 return nil , status .Errorf (codes .InvalidArgument , "input account is empty" )
712712 }
713713
@@ -925,7 +925,7 @@ func (rpc *AergoRPCService) SignTX(ctx context.Context, in *types.Tx) (*types.Tx
925925 if err := rpc .checkAuth (ctx , WriteBlockChain ); err != nil {
926926 return nil , err
927927 }
928- if in .Body == nil || len (in .Hash ) == 0 || len ( in . Hash ) > maxTxHashLength {
928+ if in .Body == nil || len (in .Hash ) == 0 {
929929 return nil , status .Errorf (codes .InvalidArgument , "input tx is empty" )
930930 }
931931
@@ -951,7 +951,7 @@ func (rpc *AergoRPCService) VerifyTX(ctx context.Context, in *types.Tx) (*types.
951951 return nil , err
952952 }
953953 //TODO : verify without account service
954- if in .Body == nil || len (in .Hash ) == 0 || len ( in . Hash ) > maxTxHashLength {
954+ if in .Body == nil || len (in .Hash ) == 0 {
955955 return nil , status .Errorf (codes .InvalidArgument , "input tx is empty" )
956956 }
957957
@@ -1120,7 +1120,7 @@ func (rpc *AergoRPCService) GetReceipt(ctx context.Context, in *types.SingleByte
11201120 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
11211121 return nil , err
11221122 }
1123- if len (in .Value ) == 0 || len ( in . Value ) > maxTxHashLength {
1123+ if len (in .Value ) == 0 {
11241124 return nil , status .Errorf (codes .InvalidArgument , "input hash is empty" )
11251125 }
11261126 result , err := rpc .hub .RequestFuture (message .ChainSvc ,
@@ -1174,7 +1174,7 @@ func (rpc *AergoRPCService) QueryContract(ctx context.Context, in *types.Query)
11741174 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
11751175 return nil , err
11761176 }
1177- if len (in .ContractAddress ) == 0 || len ( in . Queryinfo ) == 0 {
1177+ if len (in .ContractAddress ) == 0 {
11781178 return nil , status .Errorf (codes .InvalidArgument , "input contract info is empty" )
11791179 }
11801180 result , err := rpc .hub .RequestFuture (message .ChainSvc ,
@@ -1194,7 +1194,7 @@ func (rpc *AergoRPCService) QueryContractState(ctx context.Context, in *types.St
11941194 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
11951195 return nil , err
11961196 }
1197- if len (in .ContractAddress ) == 0 || len ( in . Root ) == 0 {
1197+ if len (in .ContractAddress ) == 0 {
11981198 return nil , status .Errorf (codes .InvalidArgument , "input contract info is empty" )
11991199 }
12001200 result , err := rpc .hub .RequestFuture (message .ChainSvc ,
@@ -1273,9 +1273,6 @@ func (rpc *AergoRPCService) ListEvents(ctx context.Context, in *types.FilterInfo
12731273 if err := rpc .checkAuth (ctx , ReadBlockChain ); err != nil {
12741274 return nil , err
12751275 }
1276- if len (in .ContractAddress ) == 0 || len (in .ContractAddress ) > types .AddressLength {
1277- return nil , status .Errorf (codes .InvalidArgument , "input contract info is empty" )
1278- }
12791276 result , err := rpc .hub .RequestFuture (message .ChainSvc ,
12801277 & message.ListEvents {Filter : in }, defaultActorTimeout , "rpc.(*AergoRPCService).ListEvents" ).Result ()
12811278 if err != nil {
0 commit comments