From 2d2f3d180655b806d331c6a1b7066f6a35393347 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 11 Jan 2017 11:49:10 -0800 Subject: [PATCH] Closes #1780. Result of z_getoperationstatus now sorted by creation time of operation --- src/wallet/rpcwallet.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6b0f5f528..39c540a0c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3172,6 +3172,13 @@ Value z_getoperationstatus_IMPL(const Array& params, bool fRemoveFinishedOperati } } + // sort results chronologically by creation_time + std::sort(ret.begin(), ret.end(), [](Value a, Value b) -> bool { + const int64_t t1 = find_value(a.get_obj(), "creation_time").get_int64(); + const int64_t t2 = find_value(b.get_obj(), "creation_time").get_int64(); + return t1 < t2; + }); + return ret; }