Skip to content
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

fix sub-query by block height #275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

goomario
Copy link
Contributor

Error in process <0.12824.0> on node 'arweave@127.0.0.1' with exit value:
{badarg,
    [{erlang,binary_to_integer,[557419],[]},
     {ar_http_iface_middleware,find_block,2,
...

@@ -1697,7 +1697,7 @@ search_in_block_index(H, BI) ->
%% @doc Find a block, given a type and a specifier.
find_block(<<"height">>, RawHeight) ->
BI = ar_node:get_block_index(whereis(http_entrypoint_node)),
ar_storage:read_block(binary_to_integer(RawHeight), BI);
ar_storage:read_block(RawHeight, BI);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @goomario, thank you for looking into it.

This way if you ask for /height/2, it will search for a block with the hash <<"2">>, we need to do smth like this here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use this:

find_block(<<"height">>, RawHeight) when is_integer(RawHeight) ->
	BI = ar_node:get_block_index(whereis(http_entrypoint_node)),
	ar_storage:read_block(RawHeight, BI);
find_block(<<"height">>, RawHeight) ->
	BI = ar_node:get_block_index(whereis(http_entrypoint_node)),
	ar_storage:read_block(binary_to_integer(RawHeight), BI);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's work fine, I tested.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find_block(<<"height">>, RawHeight) when is_integer(RawHeight) -> - this should never match as RawHeight is a binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants