kaspad/server/rpc/handle_get_raw_mempool.go
Svarog 369ec449a8 [NOD-509] Change organization name to kaspanet (#524)
* [NOD-509] Change organization name to kaspanet

* [NOD-509] Reorganize imports
2019-12-08 17:33:42 +02:00

24 lines
632 B
Go

package rpc
import "github.com/kaspanet/kaspad/btcjson"
// handleGetRawMempool implements the getRawMempool command.
func handleGetRawMempool(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
c := cmd.(*btcjson.GetRawMempoolCmd)
mp := s.cfg.TxMemPool
if c.Verbose != nil && *c.Verbose {
return mp.RawMempoolVerbose(), nil
}
// The response is simply an array of the transaction hashes if the
// verbose flag is not set.
descs := mp.TxDescs()
hashStrings := make([]string, len(descs))
for i := range hashStrings {
hashStrings[i] = descs[i].Tx.ID().String()
}
return hashStrings, nil
}