mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-11 16:46:42 +00:00
24 lines
632 B
Go
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
|
|
}
|