Skip to content

Commit 35c6ac0

Browse files
jholdstockjrick
authored andcommitted
wallet: Fix VSP ticket iteration bug.
Returning early meant that not all tickets were being attempted.
1 parent 3e3db0f commit 35c6ac0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

wallet/udb/txquery.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ type TicketDetails struct {
205205
// TicketDetails looks up all recorded details regarding a ticket with some
206206
// hash.
207207
//
208-
// Not finding a ticket with this hash is not an error. In this case,
209-
// a nil TicketDetiails is returned.
208+
// Not finding a ticket with this hash is not an error. In this case, a nil
209+
// TicketDetails is returned.
210210
func (s *Store) TicketDetails(ns walletdb.ReadBucket, txDetails *TxDetails) (*TicketDetails, error) {
211211
var ticketDetails = &TicketDetails{}
212212
if !stake.IsSStx(&txDetails.MsgTx) {

wallet/wallet.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3212,7 +3212,8 @@ func (w *Wallet) GetTicketsPrecise(ctx context.Context, rpcCaller Caller,
32123212
// The arguments to f may be reused and should not be kept by the caller.
32133213
//
32143214
// Because this function does not have any chain client argument, tickets are
3215-
// unable to be determined whether or not they have been missed, simply unspent.
3215+
// unable to be determined whether or not they have been missed or simply
3216+
// unspent.
32163217
func (w *Wallet) GetTickets(ctx context.Context,
32173218
f func([]*TicketSummary, *wire.BlockHeader) (bool, error),
32183219
startBlock, endBlock *BlockIdentifier) error {
@@ -3237,7 +3238,7 @@ func (w *Wallet) GetTickets(ctx context.Context,
32373238
return false, errors.Errorf("%v while trying to get "+
32383239
"ticket details for txhash: %v", err, &details[i].Hash)
32393240
}
3240-
// Continue if not a ticket
3241+
// Continue if not a ticket.
32413242
if ticketInfo == nil {
32423243
continue
32433244
}
@@ -5894,7 +5895,7 @@ func (w *Wallet) ForUnspentUnexpiredTickets(ctx context.Context,
58945895
ticketHash := *ticketSummary.Ticket.Hash
58955896
err := f(&ticketHash)
58965897
if err != nil {
5897-
return false, err
5898+
continue
58985899
}
58995900
}
59005901

0 commit comments

Comments
 (0)