Skip to content

Commit

Permalink
Add address name updating on contract re-verification (blockscout#8706)
Browse files Browse the repository at this point in the history
* Add address name updating on contract re-verification

* Changelog
  • Loading branch information
nikitosing authored Oct 26, 2023
1 parent 9132b29 commit 6852a99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
### Fixes

- [#8714](https://github.com/blockscout/blockscout/pull/8714) - Fix sourcify check
- [#8706](https://github.com/blockscout/blockscout/pull/8706) - Add address name updating on contract re-verification
- [#8705](https://github.com/blockscout/blockscout/pull/8705) - Fix sourcify enabled flag
- [#8695](https://github.com/blockscout/blockscout/pull/8695) - Don't override internal transaction error if it's present already
- [#8685](https://github.com/blockscout/blockscout/pull/8685) - Fix db pool size exceeds Postgres max connections
Expand Down
3 changes: 3 additions & 0 deletions apps/explorer/lib/explorer/chain.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3683,6 +3683,7 @@ defmodule Explorer.Chain do
# Enforce ShareLocks tables order (see docs: sharelocks.md)
insert_contract_query =
Multi.new()
|> Multi.run(:clear_primary_address_names, fn repo, _ -> clear_primary_address_names(repo, address_hash) end)
|> Multi.update(:smart_contract, smart_contract_changeset)

insert_contract_query_with_additional_sources =
Expand All @@ -3696,6 +3697,8 @@ defmodule Explorer.Chain do
insert_contract_query_with_additional_sources
|> Repo.transaction()

create_address_name(Repo, Changeset.get_field(smart_contract_changeset, :name), address_hash)

case insert_result do
{:ok, %{smart_contract: smart_contract}} ->
{:ok, smart_contract}
Expand Down

0 comments on commit 6852a99

Please sign in to comment.