Add getticketsvotebits batched command for wallet RPC
JSON handling for the new wallet command getticketsvotebits has been added. A common struct for voteBits data is now also used between getticketvotebits and getticketsvotebits.
This commit is contained in:
parent
c1420d93ad
commit
95b4e76c1d
@ -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)
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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{}{},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user