Get rescan info via RPC #222

Closed
opened 2 years ago by duke · 7 comments
duke commented 2 years ago
Owner

Parsing debug.log to get rescan progress really sucks and is very error-prone. We should be able to get data about rescan progress via RPC.

Parsing debug.log to get rescan progress really sucks and is very error-prone. We should be able to get data about rescan progress via RPC.
Poster
Owner

dev branch now has a new RPC getrescaninfo that returns data related to rescanning, including starting height (for partial rescans), current rescan height and a rescan progress which is a double between 0 and 1.

@fekt please test this out and let me know if you find any bugs

`dev` branch now has a new RPC `getrescaninfo` that returns data related to rescanning, including starting height (for partial rescans), current rescan height and a rescan progress which is a double between 0 and 1. @fekt please test this out and let me know if you find any bugs
Collaborator

I tried adding a method for this in SD similar to others like this:
void RPC::getRescanInfo(const std::function<void(QJsonValue)>& cb)

When I call it I get a seg fault though. I could be overlooking something but I noticed it doesn't return JSON in an array and not sure if that's what's causing it.

I tried adding a method for this in SD similar to others like this: `void RPC::getRescanInfo(const std::function<void(QJsonValue)>& cb)` When I call it I get a seg fault though. I could be overlooking something but I noticed it doesn't return JSON in an array and not sure if that's what's causing it.
Poster
Owner

@fekt can you push the code that is segfaulting to a branch so I can look at it?

@fekt can you push the code that is segfaulting to a branch so I can look at it?
Collaborator

@duke I pushed everything here https://git.hush.is/fekt/SilentDragon
I was testing calling in connection.cpp since that's where I was testing rescan progress previously.

@duke I pushed everything here https://git.hush.is/fekt/SilentDragon I was testing calling in connection.cpp since that's where I was testing rescan progress previously.
Poster
Owner

@fekt various RPC's return a single JSON hash, instead of an array, such as getinfo, so I am not sure. My guess is the flavor of JSON returned is causing this, such as returning a double/float instead of a string for progress. There are many incompatible versions of JSON and every library has their own flavor that they like. For instance, some JSON libraries consider duplicate keys invalid JSON, but some libraries don't care.

@fekt various RPC's return a single JSON hash, instead of an array, such as `getinfo`, so I am not sure. My guess is the flavor of JSON returned is causing this, such as returning a double/float instead of a string for progress. There are many incompatible versions of JSON and every library has their own flavor that they like. For instance, some JSON libraries consider duplicate keys invalid JSON, but some libraries don't care.
Collaborator

Disregard. Doing it wrong and can't test calling it there the way I was. Doesn't crash when I call elsewhere.

Disregard. Doing it wrong and can't test calling it there the way I was. Doesn't crash when I call elsewhere.
duke self-assigned this 2 years ago
Poster
Owner

getrescaninfo now exists and seems to work, closing this

`getrescaninfo` now exists and seems to work, closing this
duke closed this issue 2 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.