Skip to content

Commit

Permalink
udb: Remove redundant VSP pubkey check.
Browse files Browse the repository at this point in the history
Remove the mismatched pubkey check from SetVSPTicket. This check is totally
redundant - the VSP pubkey is checked every time a reponse is received from VSP,
so the process would have already errored out long before this condition was
ever hit.
  • Loading branch information
jholdstock committed Jun 24, 2023
1 parent 30e24f6 commit efededa
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions wallet/udb/vsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
package udb

import (
"bytes"

"decred.org/dcrwallet/v4/errors"
"decred.org/dcrwallet/v4/wallet/walletdb"
"github.com/decred/dcrd/chaincfg/chainhash"
Expand Down Expand Up @@ -75,23 +73,10 @@ func SetVSPTicket(dbtx walletdb.ReadWriteTx, ticketHash *chainhash.Hash, record
if err != nil {
return err
}
record.VSPHostID = vspHostID
} else if err != nil {
return err
}

// If the pubkey from the record in the request differs from the pubkey
// in the database that is saved for the host, update the pubkey in the
// db but keep the vsphost id intact.
if !bytes.Equal(pubkey.PubKey, record.PubKey) {
err = SetVSPPubKey(dbtx, []byte(record.Host), &VSPPubKey{
ID: pubkey.ID,
PubKey: record.PubKey,
})
if err != nil {
return err
}
}
record.VSPHostID = pubkey.ID

bucket := dbtx.ReadWriteBucket(vspBucketKey)
Expand Down

0 comments on commit efededa

Please sign in to comment.