Closes #2112 where z_getoperationresult could return stale status.
This commit is contained in:
parent
e96c8725af
commit
2f21206cfc
|
@ -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
|
// 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.");
|
// 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) {
|
if (fRemoveFinishedOperations) {
|
||||||
// Caller is only interested in retrieving finished results
|
// Caller is only interested in retrieving finished results
|
||||||
if (operation->isSuccess() || operation->isFailed() || operation->isCancelled()) {
|
if ("success"==s || "failed"==s || "cancelled"==s) {
|
||||||
ret.push_back(status);
|
ret.push_back(obj);
|
||||||
q->popOperationForId(id);
|
q->popOperationForId(id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ret.push_back(status);
|
ret.push_back(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue