mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-03 15:37:08 +03:00
qns_indexer: don't duplicate 0x in router namehash
This commit is contained in:
parent
2c8d0db77f
commit
763e7d6d87
@ -180,20 +180,16 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
|||||||
if let Some(name) = ipc_json["url_params"]["name"].as_str() {
|
if let Some(name) = ipc_json["url_params"]["name"].as_str() {
|
||||||
if let Some(node) = state.nodes.get(name) {
|
if let Some(node) = state.nodes.get(name) {
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc(
|
.ipc(serde_json::to_vec(&http::HttpResponse {
|
||||||
serde_json::to_vec(&http::HttpResponse {
|
status: 200,
|
||||||
status: 200,
|
headers: HashMap::from([(
|
||||||
headers: HashMap::from([(
|
"Content-Type".to_string(),
|
||||||
"Content-Type".to_string(),
|
"application/json".to_string(),
|
||||||
"application/json".to_string(),
|
)]),
|
||||||
)]),
|
})?)
|
||||||
})?,
|
|
||||||
)
|
|
||||||
.payload(Payload {
|
.payload(Payload {
|
||||||
mime: Some("application/json".to_string()),
|
mime: Some("application/json".to_string()),
|
||||||
bytes: serde_json::to_string(&node)?
|
bytes: serde_json::to_string(&node)?.as_bytes().to_vec(),
|
||||||
.as_bytes()
|
|
||||||
.to_vec(),
|
|
||||||
})
|
})
|
||||||
.send()?;
|
.send()?;
|
||||||
continue;
|
continue;
|
||||||
@ -202,15 +198,13 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Response::new()
|
Response::new()
|
||||||
.ipc(
|
.ipc(serde_json::to_vec(&http::HttpResponse {
|
||||||
serde_json::to_vec(&http::HttpResponse {
|
status: 404,
|
||||||
status: 404,
|
headers: HashMap::from([(
|
||||||
headers: HashMap::from([(
|
"Content-Type".to_string(),
|
||||||
"Content-Type".to_string(),
|
"application/json".to_string(),
|
||||||
"application/json".to_string(),
|
)]),
|
||||||
)]),
|
})?)
|
||||||
})?,
|
|
||||||
)
|
|
||||||
.send()?;
|
.send()?;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -304,13 +298,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
|
|||||||
let routers_raw = decoded.0;
|
let routers_raw = decoded.0;
|
||||||
node.routers = routers_raw
|
node.routers = routers_raw
|
||||||
.iter()
|
.iter()
|
||||||
.map(|r| {
|
.map(|r| hex::encode(r))
|
||||||
let key = format!("0x{}", hex::encode(r));
|
|
||||||
match state.names.get(&key) {
|
|
||||||
Some(name) => name.clone(),
|
|
||||||
None => format!("proposed router did not exist: 0x{}", key),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
send = true;
|
send = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user