Skip to content

Commit

Permalink
explorer_node: assets method fix (minor).
Browse files Browse the repository at this point in the history
  • Loading branch information
valdok committed May 29, 2024
1 parent afbf31f commit d43c4e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
25 changes: 19 additions & 6 deletions explorer/adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,14 +2065,27 @@ class Adapter : public Node::IObserver, public IAdapter {
MakeTableHdr("Metadata")
}));


bool bCurrent = (h >= _nodeBackend.m_Cursor.m_Full.m_Height);

Asset::Full ai;
for (ai.m_ID = 1; ; ai.m_ID++)
for (ai.m_ID = 0; ; )
{
int ret = _nodeBackend.get_AssetAt(ai, h);
if (!ret)
break;
if (ret < 0)
continue;
if (bCurrent)
{
if (!_nodeBackend.get_DB().AssetGetNext(ai))
break;
}
else
{
++ai.m_ID;
int ret = _nodeBackend.get_AssetAt(ai, h);
if (!ret)
break;

if (ret < 0)
continue;
}

ExtraInfo::Writer wr(json::array());
wr.m_json.push_back(MakeObjAid(ai.m_ID));
Expand Down
2 changes: 1 addition & 1 deletion explorer/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ OnRequest(asset)

OnRequest(assets)
{
auto height = _currentUrl.get_int_arg("height", 0);
auto height = _currentUrl.get_int_arg("height", MaxHeight);
return _backend.get_assets_at(height);
}

Expand Down

0 comments on commit d43c4e4

Please sign in to comment.