Skip to content

Commit

Permalink
fix fetch_header and fetch_transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Officeyutong committed Dec 12, 2024
1 parent deb3ce7 commit 9b69113
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions light-client-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use ckb_light_client_lib::{
types::RunEnv,
verify::verify_tx,
};
use log::{debug, info};
use log::debug;
use serde::{Deserialize, Serialize};
use serde_wasm_bindgen::Serializer;
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -305,8 +305,9 @@ pub fn fetch_header(hash: &str) -> Result<JsValue, JsValue> {
if missing {
// re-fetch the header
swc.add_fetch_header(block_hash, now);
return Ok((&FetchStatus::<ckb_jsonrpc_types::HeaderView>::NotFound,)
.serialize(&SERIALIZER)?);
return Ok(
(&FetchStatus::<ckb_jsonrpc_types::HeaderView>::NotFound).serialize(&SERIALIZER)?
);
} else if first_sent > 0 {
return Ok(FetchStatus::<ckb_jsonrpc_types::HeaderView>::Fetching {
first_sent: first_sent.into(),
Expand Down Expand Up @@ -1198,7 +1199,7 @@ pub fn fetch_transaction(tx_hash: &str) -> Result<JsValue, JsValue> {
if missing {
// re-fetch the transaction
swc.add_fetch_tx(tx_hash, now);
return Ok((FetchStatus::<TransactionWithStatus>::NotFound,).serialize(&SERIALIZER)?);
return Ok((FetchStatus::<TransactionWithStatus>::NotFound).serialize(&SERIALIZER)?);
} else if first_sent > 0 {
return Ok((FetchStatus::<TransactionWithStatus>::Fetching {
first_sent: first_sent.into(),
Expand Down

0 comments on commit 9b69113

Please sign in to comment.