Use a single long-lived RPC connection when authenticated

The prior system spawned a new connection per request to enable parallelism,
yet kept hitting hyper::IncompleteMessages I couldn't track down. This
attempts to resolve those by a long-lived socket.

Halves the amount of requests per-authenticated RPC call, and accordingly is
likely still better overall.

I don't believe this is resolved yet but this is still worth pushing.
This commit is contained in:
Luke Parker
2023-11-06 23:45:39 -05:00
parent c03fb6c71b
commit 56fd11ab8d
14 changed files with 169 additions and 76 deletions

View File

@@ -180,7 +180,7 @@ impl Wallet {
let view_pair =
ViewPair::new(ED25519_BASEPOINT_POINT * spend_key, Zeroizing::new(view_key));
let rpc = HttpRpc::new(rpc_url).expect("couldn't connect to the Monero RPC");
let rpc = HttpRpc::new(rpc_url).await.expect("couldn't connect to the Monero RPC");
let height = rpc.get_height().await.unwrap();
// Mines 200 blocks so sufficient decoys exist, as only 60 is needed for maturity
@@ -316,7 +316,7 @@ impl Wallet {
use processor::{additional_key, networks::Monero};
let rpc_url = network_rpc(NetworkId::Monero, ops, handle);
let rpc = HttpRpc::new(rpc_url).expect("couldn't connect to the Monero RPC");
let rpc = HttpRpc::new(rpc_url).await.expect("couldn't connect to the Monero RPC");
// Prepare inputs
let outputs = std::mem::take(inputs);