aezeed: fix flake in TestDecipherIncorrectMnemonic

This commit is contained in:
yyforyongyu
2023-09-05 07:43:33 +08:00
parent a252cb4528
commit 50f2c277d7

View File

@@ -533,7 +533,17 @@ func TestDecipherIncorrectMnemonic(t *testing.T) {
// a checksum failure.
swapIndex1 := 9
swapIndex2 := 13
mnemonic[swapIndex1], mnemonic[swapIndex2] = mnemonic[swapIndex2], mnemonic[swapIndex1]
mnemonic[swapIndex1], mnemonic[swapIndex2] =
mnemonic[swapIndex2], mnemonic[swapIndex1]
// If the words happen to be the same by pure chance, we'll try again
// with different indexes.
if mnemonic[swapIndex1] == mnemonic[swapIndex2] {
swapIndex1 = 3
mnemonic[swapIndex1], mnemonic[swapIndex2] =
mnemonic[swapIndex2], mnemonic[swapIndex1]
}
// If we attempt to decrypt now, we should get a checksum failure.
// If we attempt to map back to the original cipher seed now, then we