Add support for GetRawMempoolResult.
This commit is contained in:
parent
6a2b93e622
commit
81843d269f
1 changed files with 28 additions and 0 deletions
28
jsonapi.go
28
jsonapi.go
|
@ -93,6 +93,17 @@ type GetPeerInfoResult struct {
|
||||||
SyncNode bool `json:"syncnode"`
|
SyncNode bool `json:"syncnode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetRawMempoolResult models the data returned from the getrawmempool command.
|
||||||
|
type GetRawMempoolResult struct {
|
||||||
|
Size int `json:"size"`
|
||||||
|
Fee float64 `json:"fee"`
|
||||||
|
Time int64 `json:"time"`
|
||||||
|
Height int64 `json:"height"`
|
||||||
|
StartingPriority int `json:"startingpriority"`
|
||||||
|
CurrentPriority int `json:"currentpriority"`
|
||||||
|
Depends []string `json:"depends"`
|
||||||
|
}
|
||||||
|
|
||||||
// TxRawResult models the data from the getrawtransaction command.
|
// TxRawResult models the data from the getrawtransaction command.
|
||||||
type TxRawResult struct {
|
type TxRawResult struct {
|
||||||
Hex string `json:"hex"`
|
Hex string `json:"hex"`
|
||||||
|
@ -957,6 +968,23 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
result.Result = res
|
result.Result = res
|
||||||
}
|
}
|
||||||
|
case "getrawmempool":
|
||||||
|
// getrawmempool can either return a map of JSON objects or
|
||||||
|
// an array of strings depending on the verbose flag. Choose
|
||||||
|
// the right form accordingly.
|
||||||
|
if strings.Contains(string(objmap["result"]), "{") {
|
||||||
|
var res map[string]GetRawMempoolResult
|
||||||
|
err = json.Unmarshal(objmap["result"], &res)
|
||||||
|
if err == nil {
|
||||||
|
result.Result = res
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var res []string
|
||||||
|
err = json.Unmarshal(objmap["result"], &res)
|
||||||
|
if err == nil {
|
||||||
|
result.Result = res
|
||||||
|
}
|
||||||
|
}
|
||||||
case "getwork":
|
case "getwork":
|
||||||
// getwork can either return a JSON object or a boolean
|
// getwork can either return a JSON object or a boolean
|
||||||
// depending on whether or not data was provided. Choose the
|
// depending on whether or not data was provided. Choose the
|
||||||
|
|
Loading…
Add table
Reference in a new issue