Skip to content

Commit

Permalink
bug fix: LibAddressSet remove: error index (#3)
Browse files Browse the repository at this point in the history
* bug fix:LibAddressSet remove: error index

* LibAddressSet remove add delete removed value

Co-authored-by: irvinli <irvinli@webank.com>
  • Loading branch information
caseone and irvinli authored Apr 19, 2021
1 parent 7e0d201 commit 5f0be3f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/data_structure/LibAddressSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ library LibAddressSet {
uint256 lastindexMapping = self.values.length - 1;
address lastValue = self.values[lastindexMapping];
self.values[toDeleteindexMapping] = lastValue;
self.indexMapping[lastValue] = toDeleteindexMapping;
self.indexMapping[lastValue] = toDeleteindexMapping + 1;
delete self.indexMapping[value];
self.values.length--;
}

Expand Down

0 comments on commit 5f0be3f

Please sign in to comment.