From 189a3380a28c026a42f0d1e6422e236bcd0c666d Mon Sep 17 00:00:00 2001 From: Svarog Date: Tue, 10 Dec 2019 12:58:26 +0200 Subject: [PATCH] [NOD-340] Remove unimplemented RPC commands: getNetworkHashPS, estimatePriority, getChainTips, invalidateBlock, preciousBlock, reconsiderBlock (#528) * [NOD-340] Remove GetNetworkHashPS cmd * [NOD-340] Removed unimplemented commands: estimatePriority, getChainTips, invalidateBlock, preciousBlock, reconsiderBlock * [NOD-340] Apply gofmt --- README.md | 2 +- btcjson/dagsvrcmds.go | 61 ----------------- btcjson/dagsvrcmds_test.go | 81 ----------------------- btcjson/dagsvrresults.go | 1 - docs/json_rpc_api.md | 17 +---- rpcclient/dag.go | 33 +--------- rpcclient/mining.go | 84 +----------------------- server/rpc/handle_get_mining_info.go | 17 ----- server/rpc/handle_get_network_hash_ps.go | 20 ------ server/rpc/handle_rescan_blocks.go | 1 + server/rpc/rpcserver.go | 14 ++-- server/rpc/rpcserverhelp.go | 11 +--- 12 files changed, 12 insertions(+), 330 deletions(-) delete mode 100644 server/rpc/handle_get_network_hash_ps.go diff --git a/README.md b/README.md index 934b3970a..264244c29 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ btcd [![ISC License](http://img.shields.io/badge/license-ISC-blue.svg)](http://copyfree.org) [![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](http://godoc.org/github.com/kaspanet/kaspad) -btcd is an alternative full node bitcoin implementation written in Go (golang). +Kaspad is the reference full node Kaspa implementation written in Go (golang). This project is currently under active development and is in a Beta state. It is extremely stable and has been in production use since October 2013. diff --git a/btcjson/dagsvrcmds.go b/btcjson/dagsvrcmds.go index a9a2849d1..6371e6857 100644 --- a/btcjson/dagsvrcmds.go +++ b/btcjson/dagsvrcmds.go @@ -409,24 +409,6 @@ func NewGetNetTotalsCmd() *GetNetTotalsCmd { return &GetNetTotalsCmd{} } -// GetNetworkHashPSCmd defines the getNetworkHashPs JSON-RPC command. -type GetNetworkHashPSCmd struct { - Blocks *int `jsonrpcdefault:"120"` - Height *int `jsonrpcdefault:"-1"` -} - -// NewGetNetworkHashPSCmd returns a new instance which can be used to issue a -// getNetworkHashPs JSON-RPC command. -// -// The parameters which are pointers indicate they are optional. Passing nil -// for optional parameters will use the default value. -func NewGetNetworkHashPSCmd(numBlocks, height *int) *GetNetworkHashPSCmd { - return &GetNetworkHashPSCmd{ - Blocks: numBlocks, - Height: height, - } -} - // GetPeerInfoCmd defines the getPeerInfo JSON-RPC command. type GetPeerInfoCmd struct{} @@ -531,19 +513,6 @@ func NewHelpCmd(command *string) *HelpCmd { } } -// InvalidateBlockCmd defines the invalidateBlock JSON-RPC command. -type InvalidateBlockCmd struct { - BlockHash string -} - -// NewInvalidateBlockCmd returns a new instance which can be used to issue a -// invalidateBlock JSON-RPC command. -func NewInvalidateBlockCmd(blockHash string) *InvalidateBlockCmd { - return &InvalidateBlockCmd{ - BlockHash: blockHash, - } -} - // PingCmd defines the ping JSON-RPC command. type PingCmd struct{} @@ -553,32 +522,6 @@ func NewPingCmd() *PingCmd { return &PingCmd{} } -// PreciousBlockCmd defines the preciousBlock JSON-RPC command. -type PreciousBlockCmd struct { - BlockHash string -} - -// NewPreciousBlockCmd returns a new instance which can be used to issue a -// preciousBlock JSON-RPC command. -func NewPreciousBlockCmd(blockHash string) *PreciousBlockCmd { - return &PreciousBlockCmd{ - BlockHash: blockHash, - } -} - -// ReconsiderBlockCmd defines the reconsiderBlock JSON-RPC command. -type ReconsiderBlockCmd struct { - BlockHash string -} - -// NewReconsiderBlockCmd returns a new instance which can be used to issue a -// reconsiderBlock JSON-RPC command. -func NewReconsiderBlockCmd(blockHash string) *ReconsiderBlockCmd { - return &ReconsiderBlockCmd{ - BlockHash: blockHash, - } -} - // SearchRawTransactionsCmd defines the searchRawTransactions JSON-RPC command. type SearchRawTransactionsCmd struct { Address string @@ -727,7 +670,6 @@ func init() { MustRegisterCmd("getMiningInfo", (*GetMiningInfoCmd)(nil), flags) MustRegisterCmd("getNetworkInfo", (*GetNetworkInfoCmd)(nil), flags) MustRegisterCmd("getNetTotals", (*GetNetTotalsCmd)(nil), flags) - MustRegisterCmd("getNetworkHashPs", (*GetNetworkHashPSCmd)(nil), flags) MustRegisterCmd("getPeerInfo", (*GetPeerInfoCmd)(nil), flags) MustRegisterCmd("getRawMempool", (*GetRawMempoolCmd)(nil), flags) MustRegisterCmd("getRawTransaction", (*GetRawTransactionCmd)(nil), flags) @@ -735,10 +677,7 @@ func init() { MustRegisterCmd("getTxOut", (*GetTxOutCmd)(nil), flags) MustRegisterCmd("getTxOutSetInfo", (*GetTxOutSetInfoCmd)(nil), flags) MustRegisterCmd("help", (*HelpCmd)(nil), flags) - MustRegisterCmd("invalidateBlock", (*InvalidateBlockCmd)(nil), flags) MustRegisterCmd("ping", (*PingCmd)(nil), flags) - MustRegisterCmd("preciousBlock", (*PreciousBlockCmd)(nil), flags) - MustRegisterCmd("reconsiderBlock", (*ReconsiderBlockCmd)(nil), flags) MustRegisterCmd("removeManualNode", (*RemoveManualNodeCmd)(nil), flags) MustRegisterCmd("searchRawTransactions", (*SearchRawTransactionsCmd)(nil), flags) MustRegisterCmd("sendRawTransaction", (*SendRawTransactionCmd)(nil), flags) diff --git a/btcjson/dagsvrcmds_test.go b/btcjson/dagsvrcmds_test.go index 7dca4a97a..5c169b899 100644 --- a/btcjson/dagsvrcmds_test.go +++ b/btcjson/dagsvrcmds_test.go @@ -474,48 +474,6 @@ func TestDAGSvrCmds(t *testing.T) { marshalled: `{"jsonrpc":"1.0","method":"getNetTotals","params":[],"id":1}`, unmarshalled: &btcjson.GetNetTotalsCmd{}, }, - { - name: "getNetworkHashPs", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("getNetworkHashPs") - }, - staticCmd: func() interface{} { - return btcjson.NewGetNetworkHashPSCmd(nil, nil) - }, - marshalled: `{"jsonrpc":"1.0","method":"getNetworkHashPs","params":[],"id":1}`, - unmarshalled: &btcjson.GetNetworkHashPSCmd{ - Blocks: btcjson.Int(120), - Height: btcjson.Int(-1), - }, - }, - { - name: "getNetworkHashPs optional1", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("getNetworkHashPs", 200) - }, - staticCmd: func() interface{} { - return btcjson.NewGetNetworkHashPSCmd(btcjson.Int(200), nil) - }, - marshalled: `{"jsonrpc":"1.0","method":"getNetworkHashPs","params":[200],"id":1}`, - unmarshalled: &btcjson.GetNetworkHashPSCmd{ - Blocks: btcjson.Int(200), - Height: btcjson.Int(-1), - }, - }, - { - name: "getNetworkHashPs optional2", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("getNetworkHashPs", 200, 123) - }, - staticCmd: func() interface{} { - return btcjson.NewGetNetworkHashPSCmd(btcjson.Int(200), btcjson.Int(123)) - }, - marshalled: `{"jsonrpc":"1.0","method":"getNetworkHashPs","params":[200,123],"id":1}`, - unmarshalled: &btcjson.GetNetworkHashPSCmd{ - Blocks: btcjson.Int(200), - Height: btcjson.Int(123), - }, - }, { name: "getPeerInfo", newCmd: func() (interface{}, error) { @@ -661,19 +619,6 @@ func TestDAGSvrCmds(t *testing.T) { Command: btcjson.String("getBlock"), }, }, - { - name: "invalidateBlock", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("invalidateBlock", "123") - }, - staticCmd: func() interface{} { - return btcjson.NewInvalidateBlockCmd("123") - }, - marshalled: `{"jsonrpc":"1.0","method":"invalidateBlock","params":["123"],"id":1}`, - unmarshalled: &btcjson.InvalidateBlockCmd{ - BlockHash: "123", - }, - }, { name: "ping", newCmd: func() (interface{}, error) { @@ -685,32 +630,6 @@ func TestDAGSvrCmds(t *testing.T) { marshalled: `{"jsonrpc":"1.0","method":"ping","params":[],"id":1}`, unmarshalled: &btcjson.PingCmd{}, }, - { - name: "preciousBlock", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("preciousBlock", "0123") - }, - staticCmd: func() interface{} { - return btcjson.NewPreciousBlockCmd("0123") - }, - marshalled: `{"jsonrpc":"1.0","method":"preciousBlock","params":["0123"],"id":1}`, - unmarshalled: &btcjson.PreciousBlockCmd{ - BlockHash: "0123", - }, - }, - { - name: "reconsiderBlock", - newCmd: func() (interface{}, error) { - return btcjson.NewCmd("reconsiderBlock", "123") - }, - staticCmd: func() interface{} { - return btcjson.NewReconsiderBlockCmd("123") - }, - marshalled: `{"jsonrpc":"1.0","method":"reconsiderBlock","params":["123"],"id":1}`, - unmarshalled: &btcjson.ReconsiderBlockCmd{ - BlockHash: "123", - }, - }, { name: "removeManualNode", newCmd: func() (interface{}, error) { diff --git a/btcjson/dagsvrresults.go b/btcjson/dagsvrresults.go index 8a437e350..762fd4f5a 100644 --- a/btcjson/dagsvrresults.go +++ b/btcjson/dagsvrresults.go @@ -400,7 +400,6 @@ type GetMiningInfoResult struct { Generate bool `json:"generate"` GenProcLimit int32 `json:"genProcLimit"` HashesPerSec int64 `json:"hashesPerSec"` - NetworkHashPS int64 `json:"networkHashPs"` PooledTx uint64 `json:"pooledTx"` TestNet bool `json:"testNet"` DevNet bool `json:"devNet"` diff --git a/docs/json_rpc_api.md b/docs/json_rpc_api.md index a71f8ef35..d9d199644 100644 --- a/docs/json_rpc_api.md +++ b/docs/json_rpc_api.md @@ -175,7 +175,6 @@ the method name for further details such as parameter and return information. |16|[getmempoolinfo](#getmempoolinfo)|N|Returns a JSON object containing mempool-related information.| |17|[getmininginfo](#getmininginfo)|N|Returns a JSON object containing mining-related information.| |18|[getnettotals](#getnettotals)|Y|Returns a JSON object containing network traffic statistics.| -|19|[getnetworkhashps](#getnetworkhashps)|Y|Returns the estimated network hashes per second for the block heights provided by the parameters.| |20|[getpeerinfo](#getpeerinfo)|N|Returns information about each connected network peer as an array of json objects.| |21|[getrawmempool](#getrawmempool)|Y|Returns an array of hashes for all of the transactions currently in the memory pool.| |22|[getrawtransaction](#getrawtransaction)|Y|Returns information about a transaction given its hash.| @@ -397,8 +396,8 @@ Example Return|`{`
  `"bytes": 310768,`
  `"size": |Method|getmininginfo| |Parameters|None| |Description|Returns a JSON object containing mining-related information.| -|Returns|`{ (json object)`
  `"blocks": n, (numeric) latest best block`
  `"currentblocksize": n, (numeric) size of the latest best block`
  `"currentblocktx": n, (numeric) number of transactions in the latest best block`
  `"difficulty": n.nn, (numeric) current target difficulty`
  `"errors": "errors", (string) any current errors`
  `"generate": true or false, (boolean) whether or not server is set to generate coins`
  `"genproclimit": n, (numeric) number of processors to use for coin generation (-1 when disabled)`
  `"hashespersec": n, (numeric) recent hashes per second performance measurement while generating coins`
  `"networkhashps": n, (numeric) estimated network hashes per second for the most recent blocks`
  `"pooledtx": n, (numeric) number of transactions in the memory pool`
  `"testnet": true or false, (boolean) whether or not server is using testnet`
`}`| -|Example Return|`{`
  `"blocks": 236526,`
  `"currentblocksize": 185,`
  `"currentblocktx": 1,`
  `"difficulty": 256,`
  `"errors": "",`
  `"generate": false,`
  `"genproclimit": -1,`
  `"hashespersec": 0,`
  `"networkhashps": 33081554756,`
  `"pooledtx": 8,`
  `"testnet": true,`
`}`| +|Returns|`{ (json object)`
  `"blocks": n, (numeric) latest best block`
  `"currentblocksize": n, (numeric) size of the latest best block`
  `"currentblocktx": n, (numeric) number of transactions in the latest best block`
  `"difficulty": n.nn, (numeric) current target difficulty`
  `"errors": "errors", (string) any current errors`
  `"generate": true or false, (boolean) whether or not server is set to generate coins`
  `"genproclimit": n, (numeric) number of processors to use for coin generation (-1 when disabled)`
  `"hashespersec": n, (numeric) recent hashes per second performance measurement while generating coins`
  `"pooledtx": n, (numeric) number of transactions in the memory pool`
  `"testnet": true or false, (boolean) whether or not server is using testnet`
`}`| +|Example Return|`{`
  `"blocks": 236526,`
  `"currentblocksize": 185,`
  `"currentblocktx": 1,`
  `"difficulty": 256,`
  `"errors": "",`
  `"generate": false,`
  `"genproclimit": -1,`
  `"hashespersec": 0,`
  `"pooledtx": 8,`
  `"testnet": true,`
`}`| [Return to Overview](#MethodOverview)
*** @@ -413,18 +412,6 @@ Example Return|`{`
  `"bytes": 310768,`
  `"size": |Example Return|`{`
  `"totalbytesrecv": 1150990,`
  `"totalbytessent": 206739,`
  `"timemillis": 1391626433845`
`}`| [Return to Overview](#MethodOverview)
-*** - - -| | | -|---|---| -|Method|getnetworkhashps| -|Parameters|1. blocks (numeric, optional, default=120) - The number of blocks, or -1 for blocks since last difficulty change
2. height (numeric, optional, default=-1) - Perform estimate ending with this height or -1 for current best chain block height| -|Description|Returns the estimated network hashes per second for the block heights provided by the parameters.| -|Returns|numeric| -|Example Return|`6573971939`| -[Return to Overview](#MethodOverview)
- ***
diff --git a/rpcclient/dag.go b/rpcclient/dag.go index e099ec7d1..17d6d78d5 100644 --- a/rpcclient/dag.go +++ b/rpcclient/dag.go @@ -9,6 +9,7 @@ import ( "bytes" "encoding/hex" "encoding/json" + "github.com/pkg/errors" "github.com/kaspanet/kaspad/btcjson" @@ -756,35 +757,3 @@ func (c *Client) RescanBlocksAsync(blockHashes []*daghash.Hash) FutureRescanBloc func (c *Client) RescanBlocks(blockHashes []*daghash.Hash) ([]btcjson.RescannedBlock, error) { return c.RescanBlocksAsync(blockHashes).Receive() } - -// FutureInvalidateBlockResult is a future promise to deliver the result of a -// InvalidateBlockAsync RPC invocation (or an applicable error). -type FutureInvalidateBlockResult chan *response - -// Receive waits for the response promised by the future and returns the raw -// block requested from the server given its hash. -func (r FutureInvalidateBlockResult) Receive() error { - _, err := receiveFuture(r) - - return err -} - -// InvalidateBlockAsync returns an instance of a type that can be used to get the -// result of the RPC at some future time by invoking the Receive function on the -// returned instance. -// -// See InvalidateBlock for the blocking version and more details. -func (c *Client) InvalidateBlockAsync(blockHash *daghash.Hash) FutureInvalidateBlockResult { - hash := "" - if blockHash != nil { - hash = blockHash.String() - } - - cmd := btcjson.NewInvalidateBlockCmd(hash) - return c.sendCmd(cmd) -} - -// InvalidateBlock invalidates a specific block. -func (c *Client) InvalidateBlock(blockHash *daghash.Hash) error { - return c.InvalidateBlockAsync(blockHash).Receive() -} diff --git a/rpcclient/mining.go b/rpcclient/mining.go index 29f39c059..0eeb76d5f 100644 --- a/rpcclient/mining.go +++ b/rpcclient/mining.go @@ -7,6 +7,7 @@ package rpcclient import ( "encoding/hex" "encoding/json" + "github.com/kaspanet/kaspad/btcjson" "github.com/kaspanet/kaspad/util" "github.com/kaspanet/kaspad/util/daghash" @@ -200,89 +201,6 @@ func (c *Client) GetMiningInfo() (*btcjson.GetMiningInfoResult, error) { return c.GetMiningInfoAsync().Receive() } -// FutureGetNetworkHashPS is a future promise to deliver the result of a -// GetNetworkHashPSAsync RPC invocation (or an applicable error). -type FutureGetNetworkHashPS chan *response - -// Receive waits for the response promised by the future and returns the -// estimated network hashes per second for the block heights provided by the -// parameters. -func (r FutureGetNetworkHashPS) Receive() (int64, error) { - res, err := receiveFuture(r) - if err != nil { - return -1, err - } - - // Unmarshal result as an int64. - var result int64 - err = json.Unmarshal(res, &result) - if err != nil { - return 0, err - } - - return result, nil -} - -// GetNetworkHashPSAsync returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See GetNetworkHashPS for the blocking version and more details. -func (c *Client) GetNetworkHashPSAsync() FutureGetNetworkHashPS { - cmd := btcjson.NewGetNetworkHashPSCmd(nil, nil) - return c.sendCmd(cmd) -} - -// GetNetworkHashPS returns the estimated network hashes per second using the -// default number of blocks and the most recent block height. -// -// See GetNetworkHashPS2 to override the number of blocks to use and -// GetNetworkHashPS3 to override the height at which to calculate the estimate. -func (c *Client) GetNetworkHashPS() (int64, error) { - return c.GetNetworkHashPSAsync().Receive() -} - -// GetNetworkHashPS2Async returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See GetNetworkHashPS2 for the blocking version and more details. -func (c *Client) GetNetworkHashPS2Async(blocks int) FutureGetNetworkHashPS { - cmd := btcjson.NewGetNetworkHashPSCmd(&blocks, nil) - return c.sendCmd(cmd) -} - -// GetNetworkHashPS2 returns the estimated network hashes per second for the -// specified previous number of blocks working backwards from the most recent -// block height. The blocks parameter can also be -1 in which case the number -// of blocks since the last difficulty change will be used. -// -// See GetNetworkHashPS to use defaults and GetNetworkHashPS3 to override the -// height at which to calculate the estimate. -func (c *Client) GetNetworkHashPS2(blocks int) (int64, error) { - return c.GetNetworkHashPS2Async(blocks).Receive() -} - -// GetNetworkHashPS3Async returns an instance of a type that can be used to get -// the result of the RPC at some future time by invoking the Receive function on -// the returned instance. -// -// See GetNetworkHashPS3 for the blocking version and more details. -func (c *Client) GetNetworkHashPS3Async(blocks, height int) FutureGetNetworkHashPS { - cmd := btcjson.NewGetNetworkHashPSCmd(&blocks, &height) - return c.sendCmd(cmd) -} - -// GetNetworkHashPS3 returns the estimated network hashes per second for the -// specified previous number of blocks working backwards from the specified -// block height. The blocks parameter can also be -1 in which case the number -// of blocks since the last difficulty change will be used. -// -// See GetNetworkHashPS and GetNetworkHashPS2 to use defaults. -func (c *Client) GetNetworkHashPS3(blocks, height int) (int64, error) { - return c.GetNetworkHashPS3Async(blocks, height).Receive() -} - // FutureSubmitBlockResult is a future promise to deliver the result of a // SubmitBlockAsync RPC invocation (or an applicable error). type FutureSubmitBlockResult chan *response diff --git a/server/rpc/handle_get_mining_info.go b/server/rpc/handle_get_mining_info.go index 72933fbca..fae0a57f2 100644 --- a/server/rpc/handle_get_mining_info.go +++ b/server/rpc/handle_get_mining_info.go @@ -15,22 +15,6 @@ func handleGetMiningInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) } } - // Create a default getNetworkHashPs command to use defaults and make - // use of the existing getNetworkHashPs handler. - gnhpsCmd := btcjson.NewGetNetworkHashPSCmd(nil, nil) - networkHashesPerSecIface, err := handleGetNetworkHashPS(s, gnhpsCmd, - closeChan) - if err != nil { - return nil, err - } - networkHashesPerSec, ok := networkHashesPerSecIface.(int64) - if !ok { - return nil, &btcjson.RPCError{ - Code: btcjson.ErrRPCInternal.Code, - Message: "networkHashesPerSec is not an int64", - } - } - selectedTipHash := s.cfg.DAG.SelectedTipHash() selectedBlock, err := s.cfg.DAG.BlockByHash(selectedTipHash) if err != nil { @@ -48,7 +32,6 @@ func handleGetMiningInfo(s *Server, cmd interface{}, closeChan <-chan struct{}) Generate: s.cfg.CPUMiner.IsMining(), GenProcLimit: s.cfg.CPUMiner.NumWorkers(), HashesPerSec: int64(s.cfg.CPUMiner.HashesPerSecond()), - NetworkHashPS: networkHashesPerSec, PooledTx: uint64(s.cfg.TxMemPool.Count()), TestNet: config.ActiveConfig().TestNet, DevNet: config.ActiveConfig().DevNet, diff --git a/server/rpc/handle_get_network_hash_ps.go b/server/rpc/handle_get_network_hash_ps.go deleted file mode 100644 index 6b90d3080..000000000 --- a/server/rpc/handle_get_network_hash_ps.go +++ /dev/null @@ -1,20 +0,0 @@ -package rpc - -import ( - "github.com/kaspanet/kaspad/btcjson" - "github.com/kaspanet/kaspad/config" -) - -// handleGetNetworkHashPS implements the getNetworkHashPs command. -// This command had been (possibly temporarily) dropped. -// Originally it relied on height, which no longer makes sense. -func handleGetNetworkHashPS(s *Server, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) { - if config.ActiveConfig().SubnetworkID != nil { - return nil, &btcjson.RPCError{ - Code: btcjson.ErrRPCInvalidRequest.Code, - Message: "`getNetworkHashPS` is not supported on partial nodes.", - } - } - - return nil, ErrRPCUnimplemented -} diff --git a/server/rpc/handle_rescan_blocks.go b/server/rpc/handle_rescan_blocks.go index e60b5c690..ab6ac56a5 100644 --- a/server/rpc/handle_rescan_blocks.go +++ b/server/rpc/handle_rescan_blocks.go @@ -2,6 +2,7 @@ package rpc import ( "fmt" + "github.com/kaspanet/kaspad/btcjson" "github.com/kaspanet/kaspad/util/daghash" ) diff --git a/server/rpc/rpcserver.go b/server/rpc/rpcserver.go index 5847fcf4c..a1ed27d36 100644 --- a/server/rpc/rpcserver.go +++ b/server/rpc/rpcserver.go @@ -12,7 +12,6 @@ import ( "encoding/base64" "encoding/json" "fmt" - "github.com/pkg/errors" "io" "io/ioutil" "math/rand" @@ -23,6 +22,8 @@ import ( "sync/atomic" "time" + "github.com/pkg/errors" + "github.com/btcsuite/websocket" "github.com/kaspanet/kaspad/blockdag" "github.com/kaspanet/kaspad/blockdag/indexers" @@ -87,7 +88,6 @@ var rpcHandlersBeforeInit = map[string]commandHandler{ "getMempoolInfo": handleGetMempoolInfo, "getMiningInfo": handleGetMiningInfo, "getNetTotals": handleGetNetTotals, - "getNetworkHashPs": handleGetNetworkHashPS, "getPeerInfo": handleGetPeerInfo, "getRawMempool": handleGetRawMempool, "getRawTransaction": handleGetRawTransaction, @@ -109,13 +109,8 @@ var rpcHandlersBeforeInit = map[string]commandHandler{ // Commands that are currently unimplemented, but should ultimately be. var rpcUnimplemented = map[string]struct{}{ - "estimatePriority": {}, - "getChainTips": {}, - "getMempoolEntry": {}, - "getNetworkInfo": {}, - "invalidateBlock": {}, - "preciousBlock": {}, - "reconsiderBlock": {}, + "getMempoolEntry": {}, + "getNetworkInfo": {}, } // Commands that are available to a limited user @@ -151,7 +146,6 @@ var rpcLimited = map[string]struct{}{ "getHeaders": {}, "getInfo": {}, "getNetTotals": {}, - "getNetworkHashPs": {}, "getRawMempool": {}, "getRawTransaction": {}, "getTxOut": {}, diff --git a/server/rpc/rpcserverhelp.go b/server/rpc/rpcserverhelp.go index 035159594..28fe131a6 100644 --- a/server/rpc/rpcserverhelp.go +++ b/server/rpc/rpcserverhelp.go @@ -6,11 +6,12 @@ package rpc import ( - "github.com/pkg/errors" "sort" "strings" "sync" + "github.com/pkg/errors" + "github.com/kaspanet/kaspad/btcjson" ) @@ -434,7 +435,6 @@ var helpDescsEnUS = map[string]string{ "getMiningInfoResult-generate": "Whether or not server is set to generate coins", "getMiningInfoResult-genProcLimit": "Number of processors to use for coin generation (-1 when disabled)", "getMiningInfoResult-hashesPerSec": "Recent hashes per second performance measurement while generating coins", - "getMiningInfoResult-networkHashPs": "Estimated network hashes per second for the most recent blocks", "getMiningInfoResult-pooledTx": "Number of transactions in the memory pool", "getMiningInfoResult-testNet": "Whether or not server is using testnet", "getMiningInfoResult-devNet": "Whether or not server is using devnet", @@ -442,12 +442,6 @@ var helpDescsEnUS = map[string]string{ // GetMiningInfoCmd help. "getMiningInfo--synopsis": "Returns a JSON object containing mining-related information.", - // GetNetworkHashPSCmd help. - "getNetworkHashPs--synopsis": "Returns the estimated network hashes per second for the block heights provided by the parameters.", - "getNetworkHashPs-blocks": "The number of blocks, or -1 for blocks since last difficulty change", - "getNetworkHashPs-height": "Perform estimate ending with this height or -1 for current best chain block height", - "getNetworkHashPs--result0": "Estimated hashes per second", - // GetNetTotalsCmd help. "getNetTotals--synopsis": "Returns a JSON object containing network traffic statistics.", @@ -689,7 +683,6 @@ var rpcResultTypes = map[string][]interface{}{ "getMempoolInfo": {(*btcjson.GetMempoolInfoResult)(nil)}, "getMiningInfo": {(*btcjson.GetMiningInfoResult)(nil)}, "getNetTotals": {(*btcjson.GetNetTotalsResult)(nil)}, - "getNetworkHashPs": {(*int64)(nil)}, "getPeerInfo": {(*[]btcjson.GetPeerInfoResult)(nil)}, "getRawMempool": {(*[]string)(nil), (*btcjson.GetRawMempoolVerboseResult)(nil)}, "getRawTransaction": {(*string)(nil), (*btcjson.TxRawResult)(nil)},