No hardcoded client name (#8368)

* Fixes issues with version string if client name is substituted (required for Energy Web)
This commit is contained in:
Maciej Hirsz 2018-04-11 14:41:06 +02:00 committed by Niklas Adolfsson
parent 2b05eb43a9
commit 0a9114203b
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ impl Web3Client {
impl Web3 for Web3Client {
fn client_version(&self) -> Result<String> {
Ok(version().to_owned().replace("Parity/", "Parity//"))
Ok(version().to_owned().replacen("/", "//", 1))
}
fn sha3(&self, data: Bytes) -> Result<H256> {

View File

@ -24,7 +24,7 @@ fn rpc_web3_version() {
let mut io = IoHandler::new();
io.extend_with(web3);
let v = version().to_owned().replace("Parity/", "Parity//");
let v = version().to_owned().replacen("/", "//", 1);
let request = r#"{"jsonrpc": "2.0", "method": "web3_clientVersion", "params": [], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":"VER","id":1}"#.to_owned().replace("VER", v.as_ref());