-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gh 4133 contract code endpoint and HTTP refactoring #4156
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,7 @@ | |||
@title AE API: The tiny JSON encoder/decoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
|
||
blockchain_name() -> | ||
<<"aeternity">>. %% TODO: check hardcoding | ||
%% TODO: Check whether this should be hardcoded or retrieved from settings (?) | ||
<<"aeternity">>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between blockchain_name()
and network_id()
?
case aec_chain:top_block() of | ||
undefined -> error; | ||
Block -> {ok, aec_blocks:height(Block)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case aec_chain:top_block() of | |
undefined -> error; | |
Block -> {ok, aec_blocks:height(Block)} | |
case aec_chain:dirty_top_header() of | |
undefined -> error; | |
Hdr -> {ok, aec_headers:height(Block)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aec_chain:top_block()
also fetches all included transactions.
case aec_chain:top_block() of | ||
undefined -> error; | ||
Block -> {ok, aec_blocks:to_header(Block)} | ||
end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case aec_chain:top_block() of | |
undefined -> error; | |
Block -> {ok, aec_blocks:to_header(Block)} | |
end. | |
case aec_chain:top_header() of | |
undefined -> error; | |
Hdr -> {ok, Hdr} | |
end. |
top_key_block_header() -> | ||
case aec_chain:top_key_block() of | ||
{ok, Block} -> {ok, aec_blocks:to_header(Block)}; | ||
error -> error | ||
end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
top_key_block_header() -> | |
case aec_chain:top_key_block() of | |
{ok, Block} -> {ok, aec_blocks:to_header(Block)}; | |
error -> error | |
end. | |
top_key_block_header() -> | |
aec_db:ensure_activity(async_dirty, fun top_key_block_header_/0). | |
top_key_block_header_() -> | |
case aec_chain:top_header() of | |
undefined -> error; | |
Header -> | |
case aec_headers:type(Header) of | |
micro -> | |
Hash = aec_headers:prev_key_hash(Header), | |
{ok, _} = aec_chain:get_header(Hash); | |
key -> | |
{ok, Header} | |
end | |
end. |
key_block_header_at_height(Height) when is_integer(Height) -> | ||
case key_block_at_height(Height) of | ||
{ok, Block} -> {ok, aec_blocks:to_header(Block)}; | ||
Error -> Error | ||
end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key_block_header_at_height(Height) when is_integer(Height) -> | |
case key_block_at_height(Height) of | |
{ok, Block} -> {ok, aec_blocks:to_header(Block)}; | |
Error -> Error | |
end. | |
key_block_header_at_height(Height) when is_integer(Height) -> | |
case aec_chain:get_key_header_by_height(Height) of | |
{ok, _} = Ok -> Ok; | |
{error, _} = Error -> Error | |
end. |
PrevBlockHash = aec_blocks:prev_key_hash(Block), | ||
aec_chain:get_block(PrevBlockHash); | ||
true -> | ||
{ok, Block} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really??
No description provided.