diff --git a/pkg/rpc/response/result/raw_mempool.go b/pkg/rpc/response/result/raw_mempool.go new file mode 100644 index 000000000..d0a3ed518 --- /dev/null +++ b/pkg/rpc/response/result/raw_mempool.go @@ -0,0 +1,10 @@ +package result + +import "github.com/nspcc-dev/neo-go/pkg/util" + +// RawMempool represents a result of getrawmempool RPC call. +type RawMempool struct { + Height uint32 `json:"height"` + Verified []util.Uint256 `json:"verified"` + Unverified []util.Uint256 `json:"unverified"` +} diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index bac1dfeb8..a279b1b3b 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -463,13 +463,20 @@ func (s *Server) getPeers(_ request.Params) (interface{}, *response.Error) { return peers, nil } -func (s *Server) getRawMempool(_ request.Params) (interface{}, *response.Error) { +func (s *Server) getRawMempool(reqParams request.Params) (interface{}, *response.Error) { + verbose := reqParams.Value(0).GetBoolean() mp := s.chain.GetMemPool() hashList := make([]util.Uint256, 0) for _, item := range mp.GetVerifiedTransactions() { hashList = append(hashList, item.Hash()) } - return hashList, nil + if !verbose { + return hashList, nil + } + return result.RawMempool{ + Height: s.chain.BlockHeight(), + Verified: hashList, + }, nil } func (s *Server) validateAddress(reqParams request.Params) (interface{}, *response.Error) {