Skip to content

Commit

Permalink
Clear sign cache when switch wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlimg committed Jan 31, 2025
1 parent 2b5e367 commit 10013b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions wasmsdk/wallet_base.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"github.com/0chain/gosdk/zboxcore/zboxutil/httputil"
"github.com/0chain/gosdk/zcncore"
)

Expand All @@ -23,6 +24,7 @@ func splitKeys(privateKey string, numSplits int) (string, error) {
//
// nolint: unused
func setWalletInfo(jsonWallet string, splitKeyWallet bool) bool {
httputil.ClearSignCache()
err := zcncore.SetWalletInfo(jsonWallet, "bls0chain", splitKeyWallet)
if err == nil {
return true
Expand Down
8 changes: 8 additions & 0 deletions zboxcore/zboxutil/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,3 +986,11 @@ func joinUrl(baseURl string, paths ...string) (*url.URL, error) {
u.Path = path.Join(u.Path, p)
return u, nil
}

func ClearSignCache() {
c, err := lru.New[string, string](1000)
if err != nil {
panic(err)
}
SignCache = c
}

0 comments on commit 10013b5

Please sign in to comment.