From 2f21206cfcef6aacbb16a11eead13a9d6b205542 Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 22 Feb 2017 16:14:56 -0800 Subject: [PATCH] Closes #2112 where z_getoperationresult could return stale status. --- src/wallet/rpcwallet.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a23ce1a30..8f105db94 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3203,17 +3203,17 @@ UniValue z_getoperationstatus_IMPL(const UniValue& params, bool fRemoveFinishedO // It's possible that the operation was removed from the internal queue and map during this loop // throw JSONRPCError(RPC_INVALID_PARAMETER, "No operation exists for that id."); } - - UniValue status = operation->getStatus(); + UniValue obj = operation->getStatus(); + std::string s = obj["status"].get_str(); if (fRemoveFinishedOperations) { // Caller is only interested in retrieving finished results - if (operation->isSuccess() || operation->isFailed() || operation->isCancelled()) { - ret.push_back(status); + if ("success"==s || "failed"==s || "cancelled"==s) { + ret.push_back(obj); q->popOperationForId(id); } } else { - ret.push_back(status); + ret.push_back(obj); } }