From 970a56e64412ebea2933a8d4888e720931508cae Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Tue, 29 Dec 2020 20:40:46 -0600 Subject: [PATCH] rpc/jsonrpc/types: Add invalidate/reconsiderblock. This adds the command types for the upcoming invalidateblock and reconsiderblock RPC commands. --- rpc/jsonrpc/types/chainsvrcmds.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/rpc/jsonrpc/types/chainsvrcmds.go b/rpc/jsonrpc/types/chainsvrcmds.go index 0491d60e..1633542e 100644 --- a/rpc/jsonrpc/types/chainsvrcmds.go +++ b/rpc/jsonrpc/types/chainsvrcmds.go @@ -859,6 +859,19 @@ 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 an +// invalidateblock JSON-RPC command. +func NewInvalidateBlockCmd(hash string) *InvalidateBlockCmd { + return &InvalidateBlockCmd{ + BlockHash: hash, + } +} + // LiveTicketsCmd is a type handling custom marshaling and // unmarshaling of livetickets JSON RPC commands. type LiveTicketsCmd struct{} @@ -908,6 +921,19 @@ func NewPingCmd() *PingCmd { return &PingCmd{} } +// 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(hash string) *ReconsiderBlockCmd { + return &ReconsiderBlockCmd{ + BlockHash: hash, + } +} + // SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command. type SearchRawTransactionsCmd struct { Address string @@ -1179,10 +1205,12 @@ func init() { dcrjson.MustRegister(Method("getvoteinfo"), (*GetVoteInfoCmd)(nil), flags) dcrjson.MustRegister(Method("getwork"), (*GetWorkCmd)(nil), flags) dcrjson.MustRegister(Method("help"), (*HelpCmd)(nil), flags) + dcrjson.MustRegister(Method("invalidateblock"), (*InvalidateBlockCmd)(nil), flags) dcrjson.MustRegister(Method("livetickets"), (*LiveTicketsCmd)(nil), flags) dcrjson.MustRegister(Method("missedtickets"), (*MissedTicketsCmd)(nil), flags) dcrjson.MustRegister(Method("node"), (*NodeCmd)(nil), flags) dcrjson.MustRegister(Method("ping"), (*PingCmd)(nil), flags) + dcrjson.MustRegister(Method("reconsiderblock"), (*ReconsiderBlockCmd)(nil), flags) dcrjson.MustRegister(Method("regentemplate"), (*RegenTemplateCmd)(nil), flags) dcrjson.MustRegister(Method("searchrawtransactions"), (*SearchRawTransactionsCmd)(nil), flags) dcrjson.MustRegister(Method("sendrawtransaction"), (*SendRawTransactionCmd)(nil), flags)