diff --git a/mempool.go b/mempool.go index 322bf23a..4487b753 100644 --- a/mempool.go +++ b/mempool.go @@ -958,7 +958,7 @@ func (mp *txMemPool) processOrphans(hash *btcwire.ShaHash) error { } // ProcessTransaction is the main workhorse for handling insertion of new -// free-standing transactions into a memory pool. It includes functionality +// free-standing transactions into the memory pool. It includes functionality // such as rejecting duplicate transactions, ensuring transactions follow all // rules, orphan transaction handling, and insertion into the memory pool. // diff --git a/rpcserver.go b/rpcserver.go index 657c348b..8ea66978 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -870,9 +870,12 @@ func handleGetPeerInfo(s *rpcServer, cmd btcjson.Cmd, walletNotification chan [] return s.server.PeerInfo(), nil } +// mempoolDescriptor describes a JSON object which is returned for each +// transaction in the memory pool in response to a getrawmempool command with +// the verbose flag set. type mempoolDescriptor struct { Size int `json:"size"` - Fee int64 `json:"fee"` + Fee float64 `json:"fee"` Time int64 `json:"time"` Height int64 `json:"height"` StartingPriority int `json:"startingpriority"` @@ -889,8 +892,9 @@ func handleGetRawMempool(s *rpcServer, cmd btcjson.Cmd, walletNotification chan result := make(map[string]*mempoolDescriptor, len(descs)) for _, desc := range descs { mpd := &mempoolDescriptor{ - Size: desc.Tx.MsgTx().SerializeSize(), - Fee: desc.Fee, + Size: desc.Tx.MsgTx().SerializeSize(), + Fee: float64(desc.Fee) / + float64(btcutil.SatoshiPerBitcoin), Time: desc.Added.Unix(), Height: desc.Height, StartingPriority: 0, // We don't mine. @@ -909,6 +913,9 @@ func handleGetRawMempool(s *rpcServer, cmd btcjson.Cmd, walletNotification chan return result, nil } + + // The response is simply an array of the transaction hashes if the + // verbose flag is not set. hashStrings := make([]string, len(descs)) for i := range hashStrings { hashStrings[i] = descs[i].Tx.Sha().String()