Skip to content

Commit

Permalink
Merge pull request #3361 from nspcc-dev/fix-rpc-511
Browse files Browse the repository at this point in the history
rpcsrv: fix insufficient funds use
  • Loading branch information
roman-khimov authored Mar 18, 2024
2 parents 445ab97 + 27f79b8 commit 7e12cc1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/services/rpcsrv/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2657,7 +2657,7 @@ func getRelayResult(err error, hash util.Uint256) (any, *neorpc.Error) {
return nil, neorpc.WrapErrorWithData(neorpc.ErrInsufficientNetworkFee, err.Error())
case errors.Is(err, core.ErrInvalidAttribute):
return nil, neorpc.WrapErrorWithData(neorpc.ErrInvalidAttribute, err.Error())
case errors.Is(err, core.ErrMemPoolConflict):
case errors.Is(err, core.ErrInsufficientFunds), errors.Is(err, core.ErrMemPoolConflict):
return nil, neorpc.WrapErrorWithData(neorpc.ErrInsufficientFunds, err.Error())
case errors.Is(err, core.ErrInvalidSignature):
return nil, neorpc.WrapErrorWithData(neorpc.ErrInvalidSignature, err.Error())
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/rpcsrv/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,7 @@ func testRPCProtocol(t *testing.T, doRPCCall func(string, string, *testing.T) []
t.Run("insufficient funds", func(t *testing.T) {
b := testchain.NewBlock(t, chain, 1, 0, newTxWithParams(t, chain, opcode.PUSH1, 10, 899999999999, 1, false))
body := doRPCCall(fmt.Sprintf(rpc, encodeBinaryToString(t, b)), httpSrv.URL, t)
checkErrGetResult(t, body, true, neorpc.ErrVerificationFailedCode)
checkErrGetResult(t, body, true, neorpc.ErrInsufficientFundsCode)
})
t.Run("positive", func(t *testing.T) {
b := testchain.NewBlock(t, chain, 1, 0, newTxWithParams(t, chain, opcode.PUSH1, 10, 0, 1, false))
Expand Down

0 comments on commit 7e12cc1

Please sign in to comment.