Skip to content

Commit 183dbbf

Browse files
author
jagdeep sidhu
committed
dont give error if blob not found, treat as false (retry) for consuming lib
1 parent 902e550 commit 183dbbf

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bitcoin_da_client"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
edition = "2021"
55
authors = ["SYS LABS [email protected]"]
66
description = "Tools for interacting with BitcoinDA by SYS LABS"

src/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,23 @@ impl SyscoinClient {
423423
// Use positional parameter: (versionhash_or_txid: String)
424424
let params = vec![json!(actual_blob_id)];
425425

426-
let response = self.rpc_client.call("getnevmblobdata", &params).await?;
426+
// If the node does not know the blob yet, it may return an HTTP 500 with
427+
// a JSON-RPC error body like:
428+
// {"result":null,"error":{"code":-32602,"message":"Could not find blob information for versionhash ..."},"id":1}
429+
// Treat this as "not final yet" instead of a hard error so that the
430+
// dispatcher keeps polling for finality.
431+
let response = match self.rpc_client.call("getnevmblobdata", &params).await {
432+
Ok(v) => v,
433+
Err(e) => {
434+
let msg = e.to_string();
435+
if msg.contains("Could not find blob information for versionhash")
436+
|| msg.contains("\"code\":-32602")
437+
{
438+
return Ok(false);
439+
}
440+
return Err(e);
441+
}
442+
};
427443

428444
// Extract finality status from response
429445
let is_final = response

0 commit comments

Comments
 (0)