add default provider nodehashes, resubs

This commit is contained in:
bitful-pannul 2024-02-15 19:06:36 -03:00
parent 4ef0d654ea
commit cac63650ab
3 changed files with 20 additions and 11 deletions

View File

@ -1,8 +1,8 @@
[
{
"name": "default-router-1.os",
"owner": "dr. who",
"node": "0x",
"owner": "",
"node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d",
"public_key": "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db",
"ip": "147.135.114.167",
"port": 9002,
@ -10,8 +10,8 @@
},
{
"name": "default-router-2.os",
"owner": "foo",
"node": "0x",
"owner": "",
"node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458",
"public_key": "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992",
"ip": "147.135.114.167",
"port": 9003,
@ -19,8 +19,8 @@
},
{
"name": "default-router-s3.os",
"owner": "bar",
"node": "0x",
"owner": "",
"node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a",
"public_key": "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b",
"ip": "147.135.114.167",
"port": 9004,

View File

@ -191,6 +191,8 @@ fn handle_message(
}
if let Ok(EthSub { result, .. }) = eth_result {
handle_eth_sub_event(our, &mut state, result)?;
} else {
println!("app store: got eth sub error: {eth_result:?}");
}
}
Req::Http(incoming) => {

View File

@ -194,7 +194,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
set_state(&bincode::serialize(&state)?);
subscribe(1, filter)?;
subscribe(1, filter.clone())?;
let mut pending_requests: BTreeMap<u64, Vec<IndexerRequests>> = BTreeMap::new();
@ -210,7 +210,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> {
};
if source.process == "eth:distro:sys" {
handle_eth_message(&our, &mut state, &mut pending_requests, &body)?;
handle_eth_message(&our, &mut state, &mut pending_requests, &body, &filter)?;
} else {
let Ok(request) = serde_json::from_slice::<IndexerRequests>(&body) else {
println!("kns_indexer: got invalid message");
@ -252,14 +252,21 @@ fn handle_eth_message(
state: &mut State,
pending_requests: &mut BTreeMap<u64, Vec<IndexerRequests>>,
body: &[u8],
filter: &Filter,
) -> anyhow::Result<()> {
let Ok(eth_result) = serde_json::from_slice::<EthSubResult>(body) else {
return Err(anyhow::anyhow!("kns_indexer: got invalid message"));
};
if let Ok(EthSub { result, .. }) = eth_result {
if let SubscriptionResult::Log(log) = result {
handle_log(our, state, &log)?;
match eth_result {
Ok(EthSub { result, .. }) => {
if let SubscriptionResult::Log(log) = result {
handle_log(our, state, &log)?;
}
}
Err(e) => {
println!("kns_indexer: got sub error, resubscribing.. {:?}", e.error);
subscribe(1, filter.clone())?;
}
}