Skip to content

Commit

Permalink
vsp: Add missing mutex locks.
Browse files Browse the repository at this point in the history
  • Loading branch information
jholdstock authored and jrick committed Apr 24, 2023
1 parent b646752 commit a8f2b05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion internal/vsp/feepayment.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,9 @@ func (fp *feePayment) submitPayment() (err error) {
if err != nil {
log.Errorf("error abandoning expired fee tx %v", err)
}
fp.mu.Lock()
fp.feeTx = nil
fp.mu.Unlock()
}
return fmt.Errorf("payfee: %w", err)
}
Expand Down Expand Up @@ -922,7 +924,10 @@ func (fp *feePayment) confirmPayment() (err error) {
case "confirmed":
fp.remove("confirmed by VSP")
// nothing scheduled
err = w.UpdateVspTicketFeeToConfirmed(ctx, &fp.ticketHash, &fp.feeHash, fp.client.URL, fp.client.PubKey)
fp.mu.Lock()
feeHash := fp.feeHash
fp.mu.Unlock()
err = w.UpdateVspTicketFeeToConfirmed(ctx, &fp.ticketHash, &feeHash, fp.client.URL, fp.client.PubKey)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/vsp/vsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func (c *Client) TrackedTickets() []*TicketInfo {
}
c.mu.Unlock()

tickets := make([]*TicketInfo, 0, len(c.jobs))
tickets := make([]*TicketInfo, 0, len(jobs))
for _, job := range jobs {
job.mu.Lock()
tickets = append(tickets, &TicketInfo{
Expand Down

0 comments on commit a8f2b05

Please sign in to comment.