Skip to content

Commit

Permalink
fix remove wallet using an index when an account address and address …
Browse files Browse the repository at this point in the history
…lowercase are equal #5049
  • Loading branch information
astefan2 committed May 18, 2022
1 parent 2c0324a commit 0e591d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ Released with 1.0.0-beta.37 code base.
- Fix static tuple encoding (#4673) (#4884)
- Fix bug in handleRevert logic for eth_sendRawTransaction (#4902)
- Fix resolve type of getBlock function (#4911)
- Fix remove wallet using an index when an account address and address lowercase are equal (#5049)

### Changed
- Replace deprecated String.prototype.substr() (#4855)
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

0 comments on commit 0e591d4

Please sign in to comment.