rpc: move getrawmempool RPC to a separate func
This commit is contained in:
parent
4e25c9121b
commit
dfb4171e3c
1 changed files with 10 additions and 6 deletions
|
@ -258,12 +258,7 @@ Methods:
|
||||||
results = peers
|
results = peers
|
||||||
|
|
||||||
case "getrawmempool":
|
case "getrawmempool":
|
||||||
mp := s.chain.GetMemPool()
|
results, resultsErr = s.getRawMempool(reqParams)
|
||||||
hashList := make([]util.Uint256, 0)
|
|
||||||
for _, item := range mp.GetVerifiedTransactions() {
|
|
||||||
hashList = append(hashList, item.Tx.Hash())
|
|
||||||
}
|
|
||||||
results = hashList
|
|
||||||
|
|
||||||
case "getstorage":
|
case "getstorage":
|
||||||
results, resultsErr = s.getStorage(reqParams)
|
results, resultsErr = s.getStorage(reqParams)
|
||||||
|
@ -322,6 +317,15 @@ Methods:
|
||||||
s.WriteResponse(req, w, results)
|
s.WriteResponse(req, w, results)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) getRawMempool(_ request.Params) (interface{}, error) {
|
||||||
|
mp := s.chain.GetMemPool()
|
||||||
|
hashList := make([]util.Uint256, 0)
|
||||||
|
for _, item := range mp.GetVerifiedTransactions() {
|
||||||
|
hashList = append(hashList, item.Tx.Hash())
|
||||||
|
}
|
||||||
|
return hashList, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) validateAddress(reqParams request.Params) (interface{}, error) {
|
func (s *Server) validateAddress(reqParams request.Params) (interface{}, error) {
|
||||||
param, ok := reqParams.Value(0)
|
param, ok := reqParams.Value(0)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in a new issue