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

test(bug): In TestKeyManagement, test GetByAddress after replacing a key with the same name #2684

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions tm2/pkg/crypto/keys/keybase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ func TestKeyManagement(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(keyS))

// Lookup by original i2 address
infoByAddress, err := cstore.GetByAddress(i2.GetAddress())
require.NoError(t, err)
// GetByAddress should return Info with the corresponding public key
require.Equal(t, infoByAddress.GetPubKey(), i2.GetPubKey())
// Replace n2 with a new address
mn2New := `fancy assault crane note start invite ladder ordinary gold amateur check cousin text mercy speak chuckle wine raw chief isolate swallow cushion wrist piece`
_, err = cstore.CreateAccount(n2, mn2New, bip39Passphrase, p2, 0, 0)
require.NoError(t, err)
// Lookup again by the original i2 address
infoByAddress2, err := cstore.GetByAddress(i2.GetAddress())
require.NoError(t, err)
// As before, GetByAddress should return Info with the corresponding public key
require.Equal(t, infoByAddress2.GetPubKey(), i2.GetPubKey())

// addr cache gets nuked - and test skip flag
err = cstore.Delete(n2, "", true)
require.NoError(t, err)
Expand Down
Loading