Skip to content

Commit

Permalink
fix: auction bid rendering issue (#2002)
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Atanasov authored Nov 7, 2024
1 parent 6fe43a5 commit e942adf
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/ae_mdw/names.ex
Original file line number Diff line number Diff line change
Expand Up @@ -927,19 +927,8 @@ defmodule AeMdw.Names do

Model.tx(block_index: {height, _mbi}) = State.fetch!(state, Model.Tx, txi)

active_from =
case maybe_active_from do
nil ->
plain_name = tx_mod.name(tx_rec)
{:ok, Model.name(active: active_from)} = locate_name_or_auction(state, plain_name)
active_from

active_from ->
active_from
end

%{
active_from: active_from,
active_from: render_active_from(maybe_active_from, state, tx_mod, tx_rec),
height: height,
block_hash: Enc.encode(:micro_block_hash, block_hash),
source_tx_hash: Enc.encode(:tx_hash, tx_hash),
Expand All @@ -949,6 +938,19 @@ defmodule AeMdw.Names do
}
end

defp render_active_from(active_from, _state, _tx_mod, _tx_rec) when not is_nil(active_from) do
active_from
end

defp render_active_from(nil, state, tx_mod, tx_rec) do
plain_name = tx_mod.name(tx_rec)

case locate_name_or_auction(state, plain_name) do
{:ok, Model.name(active: active_from)} -> active_from
{:ok, Model.auction_bid(start_height: active_from)} -> active_from
end
end

defp serialize_owner_deactivation_key_boundary(owner_pk, nil),
do: {{owner_pk, @min_int, @min_bin}, {owner_pk, @max_int, @max_bin}}

Expand Down

0 comments on commit e942adf

Please sign in to comment.