diff --git a/dcrjson/dcrwalletextcmds.go b/dcrjson/dcrwalletextcmds.go index 72fc7c78..42c854fc 100644 --- a/dcrjson/dcrwalletextcmds.go +++ b/dcrjson/dcrwalletextcmds.go @@ -151,7 +151,7 @@ func NewGetTicketsCmd(includeImmature bool) *GetTicketsCmd { return &GetTicketsCmd{includeImmature} } -// GetTicketVoteBitsCmd defines the getticketsvotebits JSON-RPC command. +// GetTicketVoteBitsCmd defines the getticketvotebits JSON-RPC command. type GetTicketVoteBitsCmd struct { TxHash string } @@ -162,6 +162,17 @@ func NewGetTicketVoteBitsCmd(txHash string) *GetTicketVoteBitsCmd { return &GetTicketVoteBitsCmd{TxHash: txHash} } +// GetTicketsVoteBitsCmd defines the getticketsvotebits JSON-RPC command. +type GetTicketsVoteBitsCmd struct { + TxHashes []string +} + +// NewGetTicketsVoteBitsCmd returns a new instance which can be used to issue +// a getticketsvotebits JSON-RPC command. +func NewGetTicketsVoteBitsCmd(txHashes []string) *GetTicketsVoteBitsCmd { + return &GetTicketsVoteBitsCmd{TxHashes: txHashes} +} + // GetWalletFeeCmd defines the getwalletfee JSON-RPC command. type GetWalletFeeCmd struct{} @@ -469,6 +480,7 @@ func init() { MustRegisterCmd("getticketmaxprice", (*GetTicketMaxPriceCmd)(nil), flags) MustRegisterCmd("gettickets", (*GetTicketsCmd)(nil), flags) MustRegisterCmd("getticketvotebits", (*GetTicketVoteBitsCmd)(nil), flags) + MustRegisterCmd("getticketsvotebits", (*GetTicketsVoteBitsCmd)(nil), flags) MustRegisterCmd("importscript", (*ImportScriptCmd)(nil), flags) MustRegisterCmd("listscripts", (*ListScriptsCmd)(nil), flags) MustRegisterCmd("notifynewtickets", (*NotifyNewTicketsCmd)(nil), flags) diff --git a/dcrjson/dcrwalletextresults.go b/dcrjson/dcrwalletextresults.go index c27b8520..19e025de 100644 --- a/dcrjson/dcrwalletextresults.go +++ b/dcrjson/dcrwalletextresults.go @@ -45,11 +45,22 @@ type GetTicketsResult struct { Hashes []string `json:"hashes"` } +// VoteBitsData models the data stored for any given voteBits for a ticket. +type VoteBitsData struct { + VoteBits uint16 `json:"votebits"` + VoteBitsExt string `json:"votebitsext"` +} + // GetTicketVoteBitsResult models the data returned from the getticketvotebits // command. type GetTicketVoteBitsResult struct { - VoteBits uint16 `json:"votebits"` - VoteBitsExt string `json:"votebitsext"` + VoteBitsData +} + +// GetTicketsVoteBitsResult models the data returned from the getticketsvotebits +// command. +type GetTicketsVoteBitsResult struct { + VoteBitsList []VoteBitsData `json:"votebitslist"` } // ScriptInfo is the structure representing a redeem script, its hash, diff --git a/rpcserver.go b/rpcserver.go index 7492b063..3bce070c 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -218,6 +218,8 @@ var rpcAskWallet = map[string]struct{}{ "getreceivedbyaccount": struct{}{}, "getreceivedbyaddress": struct{}{}, "getstakeinfo": struct{}{}, + "getticketvotebits": struct{}{}, + "getticketsvotebits": struct{}{}, "gettransaction": struct{}{}, "gettxoutsetinfo": struct{}{}, "getunconfirmedbalance": struct{}{}, @@ -239,6 +241,7 @@ var rpcAskWallet = map[string]struct{}{ "sendmany": struct{}{}, "sendtoaddress": struct{}{}, "setaccount": struct{}{}, + "setticketvotebits": struct{}{}, "settxfee": struct{}{}, "signmessage": struct{}{}, "signrawtransaction": struct{}{},