From cb75581df22098dcd90dc2989cfc63bbe2262ff7 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 23 May 2024 10:03:39 +0200 Subject: [PATCH] Don't leak the local time and default services in the handshake Also, use "/pynode:0.0.1/" for a user-agent, same as https://github.com/laanwj/bitcoin-submittx https://github.com/laanwj/bitcoin-submittx/blob/302d2d79d4060d549d5b0cea0bf70fedc8049bde/bitcoin-submittx#L28 This is what a proposed feature in Bitcoin Core does: https://github.com/bitcoin/bitcoin/pull/29415 https://github.com/bitcoin/bitcoin/blob/057c79365c35ad802584379ebedb8b6542216214/src/net_processing.cpp#L1641-L1648 --- pushtx/src/p2p/client.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pushtx/src/p2p/client.rs b/pushtx/src/p2p/client.rs index aaf85ef..0637531 100644 --- a/pushtx/src/p2p/client.rs +++ b/pushtx/src/p2p/client.rs @@ -48,21 +48,21 @@ pub fn client(socks_proxy: Option, network: crate::Network) -> Clien network: network.into(), join_handle, our_version: VersionMessage { - version: 70015, + version: 70016, services: bitcoin::p2p::ServiceFlags::NONE, - timestamp: crate::posix_time() as i64, + timestamp: 0, receiver: bitcoin::p2p::Address { - services: bitcoin::p2p::ServiceFlags::default(), + services: bitcoin::p2p::ServiceFlags::NONE, address: [0; 8], - port: 8333, + port: 0, }, sender: bitcoin::p2p::Address { - services: bitcoin::p2p::ServiceFlags::default(), + services: bitcoin::p2p::ServiceFlags::NONE, address: [0; 8], port: 0, }, nonce: fastrand::u64(..), - user_agent: "".to_string(), + user_agent: "/pynode:0.0.1/".to_string(), start_height: 0, relay: false, },