Skip to content

Commit

Permalink
Merge PR: fix key mismatch for delete option of black/white list (#938)
Browse files Browse the repository at this point in the history
* fix key mismatch for delete option of black/white list

* fix white list delete

* fix code bugs
  • Loading branch information
KamiD authored Aug 4, 2021
1 parent cfe20ba commit 2e237a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions x/evm/types/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ func (csdb *CommitStateDB) SetContractDeploymentWhitelist(addrList AddressList)
func (csdb *CommitStateDB) DeleteContractDeploymentWhitelist(addrList AddressList) {
if csdb.Watcher.Enabled() {
for i := 0; i < len(addrList); i++ {
csdb.Watcher.DeleteContractDeploymentWhitelist(GetContractDeploymentWhitelistMemberKey(addrList[i]))
csdb.Watcher.DeleteContractDeploymentWhitelist(addrList[i])
}
}
store := csdb.ctx.KVStore(csdb.storeKey)
Expand Down Expand Up @@ -1073,7 +1073,7 @@ func (csdb *CommitStateDB) SetContractBlockedList(addrList AddressList) {
func (csdb *CommitStateDB) DeleteContractBlockedList(addrList AddressList) {
if csdb.Watcher.Enabled() {
for i := 0; i < len(addrList); i++ {
csdb.Watcher.DeleteContractBlockedList(GetContractBlockedListMemberKey(addrList[i]))
csdb.Watcher.DeleteContractBlockedList(addrList[i])
}
}
store := csdb.ctx.KVStore(csdb.storeKey)
Expand Down
10 changes: 8 additions & 2 deletions x/evm/watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,20 @@ func (w *Watcher) DeleteContractBlockedList(addr sdk.AccAddress) {
if !w.Enabled() {
return
}
w.store.Delete(evmtypes.GetContractBlockedListMemberKey(addr))
wMsg := NewMsgContractBlockedListItem(addr)
if wMsg != nil {
w.store.Delete(wMsg.GetKey())
}
}

func (w *Watcher) DeleteContractDeploymentWhitelist(addr sdk.AccAddress) {
if !w.Enabled() {
return
}
w.store.Delete(evmtypes.GetContractDeploymentWhitelistMemberKey(addr))
wMsg := NewMsgContractDeploymentWhitelistItem(addr)
if wMsg != nil {
w.store.Delete(wMsg.GetKey())
}
}

func (w *Watcher) Finalize() {
Expand Down

0 comments on commit 2e237a8

Please sign in to comment.