Devised a scheme for asynch messaging to bitcoind

And added some test code in Controller to use the scheme.

It's very asynchronous.  Needs some tuning long term to see how it deals
with load and perhaps throttle the requests if we know bitcoind is under
load.

But for right now, for testing, it should work ok.

Also in this commit small nits, plus bugfix to RPC::Message factory
methods (I forgot to populate some instance properties when constructing
the objects).

Additionally, we were registering the qMetaType wrong for RPC::Message
and RPC::Message::Id (this has been fixed).
This commit is contained in:
Calin Culianu 2019-11-18 14:32:48 +02:00
parent 0b6d6f0b70
commit f4091bb005
No known key found for this signature in database
GPG key ID: 21810A542031C02C
5 changed files with 144 additions and 15 deletions

View file

@ -71,4 +71,11 @@ void Controller::process()
Debug() << "Process called...";
if (!sm) sm = std::make_unique<StateMachine>(); // create statemachine if doest not exist
bitcoindmgr->submitRequest(this, IdMixin::newId(), "getmempoolinfo", {}, [](auto resp){ // testing
Trace() << resp.id.toString() << ": result reply: " << resp.toJsonString();
}, [](auto resp){
Trace() << resp.id.toString() << ": error response: " << resp.toJsonString();
}, [](auto id, auto msg) {
Warning() << id.toString() << ": FAIL: " << msg;
});
}