btcjson: Add preciousblock
This commit is contained in:
parent
403aaf5cf3
commit
3b5bb9fd43
3 changed files with 30 additions and 0 deletions
|
@ -534,6 +534,19 @@ func NewPingCmd() *PingCmd {
|
||||||
return &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.
|
// ReconsiderBlockCmd defines the reconsiderblock JSON-RPC command.
|
||||||
type ReconsiderBlockCmd struct {
|
type ReconsiderBlockCmd struct {
|
||||||
BlockHash string
|
BlockHash string
|
||||||
|
@ -743,6 +756,7 @@ func init() {
|
||||||
MustRegisterCmd("help", (*HelpCmd)(nil), flags)
|
MustRegisterCmd("help", (*HelpCmd)(nil), flags)
|
||||||
MustRegisterCmd("invalidateblock", (*InvalidateBlockCmd)(nil), flags)
|
MustRegisterCmd("invalidateblock", (*InvalidateBlockCmd)(nil), flags)
|
||||||
MustRegisterCmd("ping", (*PingCmd)(nil), flags)
|
MustRegisterCmd("ping", (*PingCmd)(nil), flags)
|
||||||
|
MustRegisterCmd("preciousblock", (*PreciousBlockCmd)(nil), flags)
|
||||||
MustRegisterCmd("reconsiderblock", (*ReconsiderBlockCmd)(nil), flags)
|
MustRegisterCmd("reconsiderblock", (*ReconsiderBlockCmd)(nil), flags)
|
||||||
MustRegisterCmd("searchrawtransactions", (*SearchRawTransactionsCmd)(nil), flags)
|
MustRegisterCmd("searchrawtransactions", (*SearchRawTransactionsCmd)(nil), flags)
|
||||||
MustRegisterCmd("sendrawtransaction", (*SendRawTransactionCmd)(nil), flags)
|
MustRegisterCmd("sendrawtransaction", (*SendRawTransactionCmd)(nil), flags)
|
||||||
|
|
|
@ -681,6 +681,19 @@ func TestChainSvrCmds(t *testing.T) {
|
||||||
marshalled: `{"jsonrpc":"1.0","method":"ping","params":[],"id":1}`,
|
marshalled: `{"jsonrpc":"1.0","method":"ping","params":[],"id":1}`,
|
||||||
unmarshalled: &btcjson.PingCmd{},
|
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",
|
name: "reconsiderblock",
|
||||||
newCmd: func() (interface{}, error) {
|
newCmd: func() (interface{}, error) {
|
||||||
|
|
|
@ -230,6 +230,9 @@ var rpcUnimplemented = map[string]struct{}{
|
||||||
"getblockchaininfo": {},
|
"getblockchaininfo": {},
|
||||||
"getchaintips": {},
|
"getchaintips": {},
|
||||||
"getnetworkinfo": {},
|
"getnetworkinfo": {},
|
||||||
|
"invalidateblock": {},
|
||||||
|
"preciousblock": {},
|
||||||
|
"reconsiderblock": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commands that are available to a limited user
|
// Commands that are available to a limited user
|
||||||
|
|
Loading…
Reference in a new issue