Skip to content

Commit

Permalink
wallet: Fix VSP ticket iteration bug.
Browse files Browse the repository at this point in the history
Returning early meant that not all tickets were being attempted.
  • Loading branch information
jholdstock authored and jrick committed Jul 25, 2023
1 parent 3e3db0f commit 35c6ac0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions wallet/udb/txquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ type TicketDetails struct {
// TicketDetails looks up all recorded details regarding a ticket with some
// hash.
//
// Not finding a ticket with this hash is not an error. In this case,
// a nil TicketDetiails is returned.
// Not finding a ticket with this hash is not an error. In this case, a nil
// TicketDetails is returned.
func (s *Store) TicketDetails(ns walletdb.ReadBucket, txDetails *TxDetails) (*TicketDetails, error) {
var ticketDetails = &TicketDetails{}
if !stake.IsSStx(&txDetails.MsgTx) {
Expand Down
7 changes: 4 additions & 3 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -3212,7 +3212,8 @@ func (w *Wallet) GetTicketsPrecise(ctx context.Context, rpcCaller Caller,
// The arguments to f may be reused and should not be kept by the caller.
//
// Because this function does not have any chain client argument, tickets are
// unable to be determined whether or not they have been missed, simply unspent.
// unable to be determined whether or not they have been missed or simply
// unspent.
func (w *Wallet) GetTickets(ctx context.Context,
f func([]*TicketSummary, *wire.BlockHeader) (bool, error),
startBlock, endBlock *BlockIdentifier) error {
Expand All @@ -3237,7 +3238,7 @@ func (w *Wallet) GetTickets(ctx context.Context,
return false, errors.Errorf("%v while trying to get "+
"ticket details for txhash: %v", err, &details[i].Hash)
}
// Continue if not a ticket
// Continue if not a ticket.
if ticketInfo == nil {
continue
}
Expand Down Expand Up @@ -5894,7 +5895,7 @@ func (w *Wallet) ForUnspentUnexpiredTickets(ctx context.Context,
ticketHash := *ticketSummary.Ticket.Hash
err := f(&ticketHash)
if err != nil {
return false, err
continue
}
}

Expand Down

0 comments on commit 35c6ac0

Please sign in to comment.