diff --git a/core/block_crypt.h b/core/block_crypt.h index 37993068b..bda7c0136 100644 --- a/core/block_crypt.h +++ b/core/block_crypt.h @@ -689,10 +689,13 @@ namespace beam { } - Output(const Output& o) + Output(Output&& o) :TxElement(o) ,m_Coinbase(o.m_Coinbase) ,m_Incubation(o.m_Incubation) + ,m_pConfidential(std::move(o.m_pConfidential)) + ,m_pPublic(std::move(o.m_pPublic)) + ,m_pAsset(std::move(o.m_pAsset)) { } diff --git a/explorer/adapter.cpp b/explorer/adapter.cpp index 624dde0bc..af17db8c3 100644 --- a/explorer/adapter.cpp +++ b/explorer/adapter.cpp @@ -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)); @@ -2337,6 +2350,32 @@ class Adapter : public Node::IObserver, public IAdapter { ok = false; } + struct CmpIn { + bool operator() (const NodeProcessor::TxoInfo& a, const NodeProcessor::TxoInfo& b) const { + if (a.m_hCreate < b.m_hCreate) + return true; + if (a.m_hCreate > b.m_hCreate) + return false; + if (a.m_Outp.get_MinMaturity(0) < b.m_Outp.get_MinMaturity(0)) + return true; + return false; + } + }; + std::stable_sort(vIns.begin(), vIns.end(), CmpIn()); + + struct CmpOut { + bool operator() (const NodeProcessor::TxoInfo& a, const NodeProcessor::TxoInfo& b) const { + if (a.m_hSpent < b.m_hSpent) + return true; + if (a.m_hSpent > b.m_hSpent) + return false; + if (a.m_Outp.get_MinMaturity(0) < b.m_Outp.get_MinMaturity(0)) + return true; + return false; + } + }; + std::stable_sort(vOuts.begin(), vOuts.end(), CmpOut()); + if (ok) { char buf[80]; @@ -2436,6 +2475,19 @@ class Adapter : public Node::IObserver, public IAdapter { std::vector vOuts; _nodeBackend.ExtractTreasurykWithExtra(vOuts); + struct CmpOut { + bool operator() (const NodeProcessor::TxoInfo& a, const NodeProcessor::TxoInfo& b) const { + if (a.m_Outp.m_Incubation < b.m_Outp.m_Incubation) + return true; + if (a.m_Outp.m_Incubation > b.m_Outp.m_Incubation) + return false; + if (a.m_hSpent < b.m_hSpent) + return true; + return false; + } + }; + std::stable_sort(vOuts.begin(), vOuts.end(), CmpOut()); + json outputs = json::array(); for (const auto& v : vOuts) { diff --git a/explorer/server.cpp b/explorer/server.cpp index 28369b1dd..8413071d2 100644 --- a/explorer/server.cpp +++ b/explorer/server.cpp @@ -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); }