Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup #2519

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type CoreConfig struct {
type WebConfig struct {
WebAddr string `long:"webaddr" description:"HTTP server address"`
WebTLS bool `long:"webtls" description:"Use a self-signed certificate for HTTPS with the web server. This is implied for a publicly routable (not loopback or private subnet) webaddr. When changing webaddr, you mean need to delete web.cert and web.key."`
SiteDir string `long:"sitedir" description:"Path to the 'site' directory with packaged web files. Unspecifed = default is good in most cases."`
SiteDir string `long:"sitedir" description:"Path to the 'site' directory with packaged web files. Unspecified = default is good in most cases."`
NoEmbedSite bool `long:"no-embed-site" description:"Use on-disk UI files instead of embedded resources. This also reloads the html template with every request. For development purposes."`
HTTPProfile bool `long:"httpprof" description:"Start HTTP profiler on /pprof."`
Experimental bool `long:"experimental" description:"Enable experimental features"`
Expand Down
3 changes: 2 additions & 1 deletion client/cmd/dexc-desktop/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
build/
pkg/installers
6 changes: 2 additions & 4 deletions client/cmd/dexc-desktop/syncserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func getSyncAddress(syncDir string) (addr, killKey string, err error) {
return lines[0], lines[1], nil
}

// sendKillSignal yeets a kill command to any address in the sync file.
// sendKillSignal sends a kill command to any address in the sync file.
func sendKillSignal(syncDir string) {
addr, killKey, err := getSyncAddress(syncDir)
if err != nil {
Expand Down Expand Up @@ -103,7 +103,7 @@ func synchronize(syncDir string) (startServer bool, err error) {
// Other instance will open the window.
return false, nil
} else {
return false, fmt.Errorf("sync server unexpected resonse code %d: %q", resp.StatusCode, http.StatusText(resp.StatusCode))
return false, fmt.Errorf("sync server unexpected response code %d: %q", resp.StatusCode, http.StatusText(resp.StatusCode))
}
}
// Error will probably be something like "...: no route to host", but we'll
Expand Down Expand Up @@ -159,7 +159,6 @@ type syncServer struct {
}

func (s *syncServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {

switch r.URL.Path {
case "/":
w.WriteHeader(http.StatusOK)
Expand Down Expand Up @@ -193,5 +192,4 @@ func (s *syncServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
log.Errorf("syncServer received a request with an unknown path %q", r.URL.Path)
}

}
2 changes: 1 addition & 1 deletion client/comms/wsconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func TestWsConn(t *testing.T) {
t.Fatalf("expected next id to be %d, got %d", 2, next)
}

// Ensure the request got logged, also unregistering the response handler.
// Ensure the request got logged, also unregister the response handler.
hndlr := wsc.respHandler(mId)
if hndlr == nil {
t.Fatalf("no handler found")
Expand Down
2 changes: 1 addition & 1 deletion client/core/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func TestAccountImport(t *testing.T) {
t.Fatalf("expected execution of db.CreateAccount")
}
if rig.db.accountInfoPersisted.Host != host {
t.Fatalf("unexprected accountInfo Host")
t.Fatalf("unexpected accountInfo Host")
}
DEXpubKey, _ := hex.DecodeString(account.DEXPubKey)
if !bytes.Equal(rig.db.accountInfoPersisted.DEXPubKey.SerializeCompressed(), DEXpubKey) {
Expand Down
38 changes: 19 additions & 19 deletions client/db/bolt/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1223,15 +1223,15 @@ func TestDeleteInactiveMatches(t *testing.T) {

numToDoO := 1000
numActiveO := 500
numActiveOrdWithMtch := 481
numActiveOrdWithMatch := 481

if testing.Short() {
numToDoO = 24
numActiveO = 11
numActiveOrdWithMtch = 6
numActiveOrdWithMatch = 6
}

activeOrdsWithMtch := make([]order.OrderID, numActiveOrdWithMtch)
activeOrdsWithMatch := make([]order.OrderID, numActiveOrdWithMatch)
var anInactiveOrder order.OrderID
orders := make(map[int]*db.MetaOrder, numToDoO)
nTimes(numToDoO, func(i int) {
Expand Down Expand Up @@ -1267,8 +1267,8 @@ func TestDeleteInactiveMatches(t *testing.T) {
if i == numActiveO {
anInactiveOrder = ord.ID()
}
if i < numActiveOrdWithMtch {
activeOrdsWithMtch[i] = ord.ID()
if i < numActiveOrdWithMatch {
activeOrdsWithMatch[i] = ord.ID()
}
})

Expand Down Expand Up @@ -1313,8 +1313,8 @@ func TestDeleteInactiveMatches(t *testing.T) {
} else {
// Some matches will not be deleted if they have an
// active order.
if i >= numNewer+numActive && i < numActive+numNewer+numActiveOrdWithMtch {
m.OrderID = activeOrdsWithMtch[i-numActive-numNewer]
if i >= numNewer+numActive && i < numActive+numNewer+numActiveOrdWithMatch {
m.OrderID = activeOrdsWithMatch[i-numActive-numNewer]
} else {
m.OrderID = anInactiveOrder
}
Expand All @@ -1337,10 +1337,10 @@ func TestDeleteInactiveMatches(t *testing.T) {
var (
olderThan = time.UnixMilli(int64(stamp))
matchN = 0
perMatchFn = func(mtch *db.MetaMatch, isSell bool) error {
perMatchFn = func(m *db.MetaMatch, isSell bool) error {
matchN++
if matchN%100 == 0 {
fmt.Printf("Deleted %d'th match %v with isSell %v\n", matchN, mtch.MatchID, isSell)
fmt.Printf("Deleted %d'th match %v with isSell %v\n", matchN, m.MatchID, isSell)
}
return nil
}
Expand Down Expand Up @@ -1375,7 +1375,7 @@ func TestDeleteInactiveMatches(t *testing.T) {
}); err != nil {
t.Fatalf("unable to count archived matches: %v", err)
}
numLeft := numNewer + numActiveOrdWithMtch
numLeft := numNewer + numActiveOrdWithMatch
if numArchivedMatches != numLeft {
t.Fatalf("expected %d archived matches left after deletion but got %d", numLeft, numArchivedMatches)
}
Expand All @@ -1402,14 +1402,14 @@ func TestDeleteInactiveOrders(t *testing.T) {
numToDo := 10008
numActive := 1000
numNewer := 1111
numActiveMtchWithOrd := 481
numActiveMatchWithOrd := 481
if testing.Short() {
numToDo = 48
numActive = 10
numNewer = 4
numActiveMtchWithOrd = 5
numActiveMatchWithOrd = 5
}
activeMtchsWithOrd := make([]order.OrderID, numActiveMtchWithOrd)
activeMatchsWithOrd := make([]order.OrderID, numActiveMatchWithOrd)
orders := make(map[int]*db.MetaOrder, numToDo)
orderIndex := make(map[order.OrderID]order.Order)
nTimes(numToDo, func(i int) {
Expand All @@ -1431,8 +1431,8 @@ func TestDeleteInactiveOrders(t *testing.T) {
ord := randOrderForMarket(base, quote)

// These orders will be inserted into active matches.
if i > numToDo/2 && i <= numToDo/2+numActiveMtchWithOrd {
activeMtchsWithOrd[i-numToDo/2-1] = ord.ID()
if i > numToDo/2 && i <= numToDo/2+numActiveMatchWithOrd {
activeMatchsWithOrd[i-numToDo/2-1] = ord.ID()
}

orders[i] = &db.MetaOrder{
Expand Down Expand Up @@ -1464,7 +1464,7 @@ func TestDeleteInactiveOrders(t *testing.T) {
t.Logf("~ %d milliseconds to insert %d MetaOrder", int(time.Since(tStart)/time.Millisecond)-numToDo, numToDo)

numToDoM := 1000
numActiveM := 500 // must be more than numActiveMtchWithOrd
numActiveM := 500 // must be more than numActiveMatchWithOrd
if testing.Short() {
numToDoM = 24
numActiveM = 8
Expand All @@ -1483,8 +1483,8 @@ func TestDeleteInactiveOrders(t *testing.T) {
UserMatch: ordertest.RandomUserMatch(),
}
// Insert orders in active matches to be ignored.
if i < numActiveMtchWithOrd {
m.OrderID = activeMtchsWithOrd[i]
if i < numActiveMatchWithOrd {
m.OrderID = activeMatchsWithOrd[i]
}
if i < numActiveM {
m.Status = order.MatchStatus(rand.Intn(4))
Expand Down Expand Up @@ -1544,7 +1544,7 @@ func TestDeleteInactiveOrders(t *testing.T) {
}); err != nil {
t.Fatalf("unable to count archived orders: %v", err)
}
numUntouched := numNewer + numActiveMtchWithOrd
numUntouched := numNewer + numActiveMatchWithOrd
if numArchivedOrders != numUntouched {
t.Fatalf("expected %d archived orders left after deletion but got %d", numUntouched, numArchivedOrders)
}
Expand Down
2 changes: 1 addition & 1 deletion client/db/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type DB interface {
// If no time is supplied, the current time is used. Accepts an optional
// function to perform on deleted matches that includes if it was a sell
// order.
DeleteInactiveMatches(ctx context.Context, olderThan *time.Time, perMatchFn func(mtch *MetaMatch, isSell bool) error) (int, error)
DeleteInactiveMatches(ctx context.Context, olderThan *time.Time, perMatchFn func(match *MetaMatch, isSell bool) error) (int, error)
// SetSeedGenerationTime stores the time when the app seed was generated.
SetSeedGenerationTime(time uint64) error
// SeedGenerationTime fetches the time when the app seed was generated.
Expand Down
4 changes: 2 additions & 2 deletions client/db/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ func decodeMatchProof_v1(pushes [][]byte) (*MatchProof, error) {

func decodeMatchProof_v2(pushes [][]byte) (*MatchProof, error) {
// Add the MatchProof SwapFeeConfirmed and RedemptionFeeConfirmed bytes.
// True because all fees until now are comfirmed.
// True because all fees until now are confirmed.
pushes = append(pushes, encode.ByteTrue, encode.ByteTrue)
return decodeMatchProof_v3(pushes)
}
Expand Down Expand Up @@ -924,7 +924,7 @@ func (w *Wallet) ID() []byte {
return uint32Bytes(w.AssetID)
}

// SID is a string respresentation of the wallet's asset ID.
// SID is a string representation of the wallet's asset ID.
func (w *Wallet) SID() string {
return strconv.Itoa(int(w.AssetID))
}
Expand Down