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

Problem deleting account when checksummed address is equal to lowercase address #5050

Merged
merged 2 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ Released with 1.0.0-beta.37 code base.

### Fixed
- Fix typos in web3-eth-accounts.rst & TESTING.md (#5047)
- Fix remove wallet using an index when an account address and address lowercase are equal (#5049)
- Improve README.md & Fix typos (#4848)
- Add optional hex formatting parameter for getTransactionrReceipt (#5153)
- Fix transactionRoot -> transactionsRoot in BlockHeader (#5083)
Expand Down
6 changes: 4 additions & 2 deletions packages/web3-eth-accounts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,10 @@ Wallet.prototype.remove = function(addressOrIndex) {
this[account.address].privateKey = null;
delete this[account.address];
// address lowercase
this[account.address.toLowerCase()].privateKey = null;
delete this[account.address.toLowerCase()];
if (this[account.address.toLowerCase()]) {
this[account.address.toLowerCase()].privateKey = null;
delete this[account.address.toLowerCase()];
}
// index
this[account.index].privateKey = null;
delete this[account.index];
Expand Down
6 changes: 6 additions & 0 deletions test/eth.accounts.wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ var tests = [
data: 'Some data!%$$%&@*',
// signature done with personal_sign
signature: '0x05252412b097c5d080c994d1ea12abcee6f1cae23feb225517a0b691a66e12866b3f54292f9cfef98f390670b4d010fc4af7fcd46e41d72870602c117b14921c1c'
}, {
address: '0x92b7254537e2890f728187988b829b28a01333ce',
privateKey: '0xaa237230fc60e46175256cbc931852514364089a9f4e5b59b5217483b2df4df7',
data: 'Some data!%$$%&@*',
// signature done with personal_sign
signature: '0xb9772194346dbf4fabf34e47f6305edf25c3de0b26b2b85f4778b49c1990115149ba4bf730ae3f9cd303769bb5bdcdf564e3a467ae061031dc368aab798fec091b'
}
];

Expand Down