Open easeev opened 11 months ago
Is the issue that the IP address is changing or is the recipient (server hosting the bitcoin node) doing some dispatch using the host header?
Is the issue that the IP address is changing or is the recipient (server hosting the bitcoin node) doing some dispatch using the host header?
Both. IP can change at any time as it's dynamically provisioned, as well as routing is done via hostname instead of IP
Looked into it and the reason for this is because bitcoincore_rpc
crate we are using uses a minimal dependency http transport. It does allow providing a custom transport through a public trait Transport
, we plan do upgrade to reqwest
soon anyways so that might help (#2716). We would have to do something like this:
struct Reqwest {
client: reqwest::blocking::Client,
url: String,
}
impl Transport for Reqwest {
/// Sends an RPC request over the transport.
fn send_request(&self, request: Request) -> Result<Response, Error> {
let body = serde_json::to_vec(&request)?;
let response = self.client.post(&self.url).body(body).send().unwrap();
Ok(response.json().unwrap())
}
/// Sends a batch of RPC requests over the transport.
fn send_batch(&self, _: &[Request]) -> Result<Vec<Response>, Error> {
todo!()
}
/// Formats the target of this transport. I.e. the URL/socket/...
fn fmt_target(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
todo!()
}
}
Whereas
And
After looking into the traffic it becomes apparent that
ord
is resolving the hostname to IP and then querying it instead of making a query using the provided hostnameLooks like something that should be fixed