From 6289d4495ee7ec1186874bd8c498a6fb12129e7d Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Tue, 12 Sep 2023 06:20:22 +0100 Subject: [PATCH 1/2] ignore darwin installers dir Signed-off-by: Philemon Ukane --- client/cmd/dexc-desktop/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/cmd/dexc-desktop/.gitignore b/client/cmd/dexc-desktop/.gitignore index d16386367f..f99483cabf 100644 --- a/client/cmd/dexc-desktop/.gitignore +++ b/client/cmd/dexc-desktop/.gitignore @@ -1 +1,2 @@ -build/ \ No newline at end of file +build/ +pkg/installers \ No newline at end of file From 6c441527eeed7176d438d59c1fab0de5a70f0a10 Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Tue, 12 Sep 2023 06:20:37 +0100 Subject: [PATCH 2/2] fix typos Signed-off-by: Philemon Ukane --- client/app/config.go | 2 +- client/cmd/dexc-desktop/syncserver.go | 6 ++--- client/comms/wsconn_test.go | 2 +- client/core/account_test.go | 2 +- client/db/bolt/db_test.go | 38 +++++++++++++-------------- client/db/interface.go | 2 +- client/db/types.go | 4 +-- 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/client/app/config.go b/client/app/config.go index 732b69fb65..3953d7b227 100644 --- a/client/app/config.go +++ b/client/app/config.go @@ -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"` diff --git a/client/cmd/dexc-desktop/syncserver.go b/client/cmd/dexc-desktop/syncserver.go index df874bd093..239095d300 100644 --- a/client/cmd/dexc-desktop/syncserver.go +++ b/client/cmd/dexc-desktop/syncserver.go @@ -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 { @@ -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 @@ -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) @@ -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) } - } diff --git a/client/comms/wsconn_test.go b/client/comms/wsconn_test.go index d507534b37..155350aa1c 100644 --- a/client/comms/wsconn_test.go +++ b/client/comms/wsconn_test.go @@ -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") diff --git a/client/core/account_test.go b/client/core/account_test.go index 6ef5ba512e..10142e1f5b 100644 --- a/client/core/account_test.go +++ b/client/core/account_test.go @@ -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) { diff --git a/client/db/bolt/db_test.go b/client/db/bolt/db_test.go index f35750cab4..cdb47dd08f 100644 --- a/client/db/bolt/db_test.go +++ b/client/db/bolt/db_test.go @@ -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) { @@ -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() } }) @@ -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 } @@ -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 } @@ -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) } @@ -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) { @@ -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{ @@ -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 @@ -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)) @@ -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) } diff --git a/client/db/interface.go b/client/db/interface.go index 90785e7130..6145587b2e 100644 --- a/client/db/interface.go +++ b/client/db/interface.go @@ -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. diff --git a/client/db/types.go b/client/db/types.go index adbe1a40cd..86c33e4103 100644 --- a/client/db/types.go +++ b/client/db/types.go @@ -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) } @@ -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)) }