Skip to content

Commit

Permalink
fix: btc wallet cache key.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhangguiguang committed May 30, 2024
1 parent 22f52cd commit cbf1236
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/wallet/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ func TestCache(t *testing.T) {
require.Nil(t, err)
require.Equal(t, bitcoinAddress.Value, "bc1pn8rv6lqakzlz7yvflc24qjv0pjx8w0plcfq34jl6scs7pqcac2wqjymurp")

bitcoinAddress2, err := wallet.BitcoinAccountInfo("mainnet", 2).Address()
require.Nil(t, err)
require.Equal(t, bitcoinAddress2.Value, "3CZw6pGHD8VVqAhhJZFQKXLLkNkkhqTRHS")

dogecoinAddress, err := wallet.DogecoinAccountInfo("mainnet").Address()
require.Nil(t, err)
require.Equal(t, dogecoinAddress.Value, "DNEJHtF6qjTsWH9muEH5BoQbAmUkyvvDC9")
Expand Down
2 changes: 1 addition & 1 deletion core/wallet/cache_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (w *CacheWallet) PolkaAccountInfo(network int) *AccountInfo {
func (w *CacheWallet) BitcoinAccountInfo(chainnet string, addressType btc.AddressType) *AccountInfo {
return &AccountInfo{
Wallet: w,
cacheKey: fmt.Sprintf("bitcoin-%v", chainnet),
cacheKey: fmt.Sprintf("bitcoin-%v-%v", chainnet, addressType),
mnemonicCreator: func(val string) (base.Account, error) {
return btc.NewAccountWithMnemonic(val, chainnet, addressType)
},
Expand Down

0 comments on commit cbf1236

Please sign in to comment.