Skip to content

Commit fc358ac

Browse files
jholdstockjrick
authored andcommitted
vsp: Extra debug logging.
1 parent 6c48f55 commit fc358ac

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

wallet/vsp.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/decred/dcrd/wire"
2222
"github.com/decred/slog"
2323
vspd "github.com/decred/vspd/client/v4"
24+
"github.com/decred/vspd/types/v3"
2425
)
2526

2627
type DialFunc func(ctx context.Context, network, addr string) (net.Conn, error)
@@ -139,18 +140,29 @@ func (c *VSPClient) ProcessManagedTickets(ctx context.Context, tickets []*VSPTic
139140
_, ok := c.jobs[*hash]
140141
c.mu.Unlock()
141142
if ok {
143+
c.log.Debugf("Ticket %s already added to vsp client", ticket)
142144
// Already processing this ticket with the VSP.
143145
continue
144146
}
145147

146-
// Make ticketstatus api call and only continue if ticket is
147-
// found managed by this vsp. The rest is the same codepath as
148-
// for processing a new ticket.
148+
// Make ticketstatus API call and only continue if ticket is found
149+
// managed by this VSP. The rest is the same codepath as for processing
150+
// a new ticket.
149151
status, err := c.status(ctx, ticket)
150152
if err != nil {
151153
if errors.Is(err, errors.Locked) {
152154
return err
153155
}
156+
157+
// Noop if ticket is not known by this VSP.
158+
var apiErr types.ErrorResponse
159+
if errors.As(err, &apiErr) && apiErr.Code == types.ErrUnknownTicket {
160+
c.log.Debugf("Ticket %s not known by vsp", ticket)
161+
continue
162+
}
163+
164+
c.log.Debugf("Ticket %s not added to vsp client, vsp status error: %v",
165+
ticket, err)
154166
continue
155167
}
156168

@@ -163,6 +175,8 @@ func (c *VSPClient) ProcessManagedTickets(ctx context.Context, tickets []*VSPTic
163175
if err != nil {
164176
return err
165177
}
178+
179+
c.log.Debugf("Ticket %s already confirmed by vsp", ticket)
166180
continue
167181
} else if status.FeeTxHash != "" {
168182
feeHash, err := chainhash.NewHashFromStr(status.FeeTxHash)

0 commit comments

Comments
 (0)