Skip to content

Commit 7c551ce

Browse files
committed
[release-v1.8] vsp: Only remove confirmed payments
The only way to be certain a VSP has acknowledged a fee tx and added a ticket to its voting wallets is to check FeeTxStatus == "confirmed". Checking for 6 confirmations on the fee tx is not an adequate substitute. For example, if a client has broadcast it's own fee tx rather than waiting for the VSP to do it, it's possible that the tx could be mined and have 6+ confs, but the amount paid is not enough, or the payment is sent to the wrong address. Backport of 3c8cd47
1 parent c4c6c42 commit 7c551ce

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

internal/vsp/feepayment.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -865,31 +865,7 @@ func (fp *feePayment) confirmPayment() (err error) {
865865

866866
status, err := fp.client.status(ctx, &fp.ticketHash)
867867
if err != nil {
868-
869868
log.Warnf("Rescheduling status check for %v: %v", &fp.ticketHash, err)
870-
871-
// Stop processing if the status check cannot be performed, but
872-
// a significant amount of confirmations are observed on the fee
873-
// transaction.
874-
//
875-
// Otherwise, chedule another confirmation check, in case the
876-
// status API can be performed at a later time or more
877-
// confirmations are observed.
878-
fp.mu.Lock()
879-
feeHash := fp.feeHash
880-
fp.mu.Unlock()
881-
confs, err := w.TxConfirms(ctx, &feeHash)
882-
if err != nil {
883-
return err
884-
}
885-
if confs >= 6 {
886-
fp.remove("confirmed")
887-
err = w.UpdateVspTicketFeeToConfirmed(ctx, &fp.ticketHash, &feeHash, fp.client.URL, fp.client.PubKey)
888-
if err != nil {
889-
return err
890-
}
891-
return nil
892-
}
893869
fp.schedule("confirm payment", fp.confirmPayment)
894870
return nil
895871
}

0 commit comments

Comments
 (0)