Remove hash param from CanTicketVote.

CanTicketVote already has the full rawTx, so it doesn't need the hash passed in separately.
This commit is contained in:
jholdstock 2022-03-30 11:54:40 +01:00 committed by Jamie Holdstock
parent 9c334d8afc
commit b32bb56032
5 changed files with 7 additions and 7 deletions

View File

@ -212,7 +212,7 @@ func (c *DcrdRPC) ExistsLiveTicket(ticketHash string) (bool, error) {
// CanTicketVote checks determines whether a ticket is able to vote at some
// point in the future by checking that it is currently either immature or live.
func (c *DcrdRPC) CanTicketVote(rawTx *dcrdtypes.TxRawResult, ticketHash string, netParams *chaincfg.Params) (bool, error) {
func (c *DcrdRPC) CanTicketVote(rawTx *dcrdtypes.TxRawResult, netParams *chaincfg.Params) (bool, error) {
// Tickets which have more than (TicketMaturity+TicketExpiry+1)
// confirmations are too old to vote.
@ -226,7 +226,7 @@ func (c *DcrdRPC) CanTicketVote(rawTx *dcrdtypes.TxRawResult, ticketHash string,
}
// If ticket is currently live, it will be able to vote in future.
live, err := c.ExistsLiveTicket(ticketHash)
live, err := c.ExistsLiveTicket(rawTx.Txid)
if err != nil {
return false, err
}

View File

@ -123,7 +123,7 @@ func (s *Server) feeAddress(c *gin.Context) {
}
// Ensure this ticket is eligible to vote at some point in the future.
canVote, err := dcrdClient.CanTicketVote(rawTicket, ticketHash, s.cfg.NetParams)
canVote, err := dcrdClient.CanTicketVote(rawTicket, s.cfg.NetParams)
if err != nil {
log.Errorf("%s: dcrd.CanTicketVote error (ticketHash=%s): %v", funcName, ticketHash, err)
s.sendError(errInternalError, c)

View File

@ -72,7 +72,7 @@ func (s *Server) payFee(c *gin.Context) {
}
// Ensure this ticket is eligible to vote at some point in the future.
canVote, err := dcrdClient.CanTicketVote(rawTicket, ticket.Hash, s.cfg.NetParams)
canVote, err := dcrdClient.CanTicketVote(rawTicket, s.cfg.NetParams)
if err != nil {
log.Errorf("%s: dcrd.CanTicketVote error (ticketHash=%s): %v", funcName, ticket.Hash, err)
s.sendError(errInternalError, c)

View File

@ -21,7 +21,7 @@ var _ Node = (*rpc.DcrdRPC)(nil)
// Node is satisfied by *rpc.DcrdRPC and retrieves data from the blockchain.
type Node interface {
CanTicketVote(rawTx *dcrdtypes.TxRawResult, ticketHash string, netParams *chaincfg.Params) (bool, error)
CanTicketVote(rawTx *dcrdtypes.TxRawResult, netParams *chaincfg.Params) (bool, error)
GetRawTransaction(txHash string) (*dcrdtypes.TxRawResult, error)
}
@ -90,7 +90,7 @@ func (s *Server) setAltSignAddr(c *gin.Context) {
}
// Ensure this ticket is eligible to vote at some point in the future.
canVote, err := dcrdClient.CanTicketVote(rawTicket, ticketHash, s.cfg.NetParams)
canVote, err := dcrdClient.CanTicketVote(rawTicket, s.cfg.NetParams)
if err != nil {
log.Errorf("%s: dcrd.CanTicketVote error (ticketHash=%s): %v", funcName, ticketHash, err)
s.sendError(errInternalError, c)

View File

@ -120,7 +120,7 @@ type testNode struct {
getRawTransactionErr error
}
func (n *testNode) CanTicketVote(_ *dcrdtypes.TxRawResult, _ string, _ *chaincfg.Params) (bool, error) {
func (n *testNode) CanTicketVote(_ *dcrdtypes.TxRawResult, _ *chaincfg.Params) (bool, error) {
return n.canTicketVote, n.canTicketVoteErr
}