Skip to content

Commit

Permalink
chore: impl review suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Nov 19, 2024
1 parent 704bb88 commit dbaa473
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions resource/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ impl Resource {
SourceFiles::new(&BUNDLED_CELL, &BUNDLED).read(bundled)
}
Resource::FileSystem { file } => Ok(Box::new(BufReader::new(fs::File::open(file)?))),
Resource::Raw { raw } => Ok(Box::new(BufReader::new(Cursor::new(
raw.to_owned().into_bytes(),
)))),
Resource::Raw { raw } => Ok(Box::new(Cursor::new(raw.to_owned().into_bytes()))),
}
}

Expand Down
2 changes: 1 addition & 1 deletion tx-pool/src/block_assembler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ impl BlockAssembler {
config: &BlockAssemblerConfig,
snapshot: &Snapshot,
) -> CellbaseWitness {
let hash_type: ScriptHashType = config.hash_type.into();
let hash_type: ScriptHashType = config.hash_type.clone().into();
let cellbase_lock = Script::new_builder()
.args(config.args.as_bytes().pack())
.code_hash(config.code_hash.pack())
Expand Down
2 changes: 1 addition & 1 deletion util/jsonrpc-types/src/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::fmt;
/// when the low 1 bit is 0, it indicates the data,
/// and then it relies on the high 7 bits to indicate
/// that the data actually corresponds to the version.
#[derive(Default, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash, Debug, JsonSchema)]
#[derive(Default, Clone, Serialize, Deserialize, PartialEq, Eq, Hash, Debug, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ScriptHashType {
/// Type "data" matches script code via cell data hash, and run the script code in v0 CKB VM.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl AsyncRichIndexerHandle {
if let Some(script) = filter.script.as_ref() {
query = query
.bind(script.code_hash.as_bytes())
.bind(script.hash_type as i16);
.bind(script.hash_type.clone() as i16);
// Default prefix search
query = query
.bind(script.args.as_bytes())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl AsyncRichIndexerHandle {
if let Some(script) = filter.script.as_ref() {
query = query
.bind(script.code_hash.as_bytes())
.bind(script.hash_type as i16);
.bind(script.hash_type.clone() as i16);
// Default prefix search
query = query
.bind(script.args.as_bytes())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub async fn get_tx_with_cell(
for _ in 0..2 {
query = query
.bind(search_key.script.code_hash.as_bytes())
.bind(search_key.script.hash_type as i16);
.bind(search_key.script.hash_type.clone() as i16);
match &search_key.script_search_mode {
Some(IndexerSearchMode::Prefix) | None => {
query = query
Expand All @@ -217,7 +217,7 @@ pub async fn get_tx_with_cell(
if let Some(script) = filter.script.as_ref() {
query = query
.bind(script.code_hash.as_bytes())
.bind(script.hash_type as i16);
.bind(script.hash_type.clone() as i16);
// Default prefix search
query = query
.bind(script.args.as_bytes())
Expand Down Expand Up @@ -343,7 +343,7 @@ pub async fn get_tx_with_cells(
for _ in 0..2 {
query = query
.bind(search_key.script.code_hash.as_bytes())
.bind(search_key.script.hash_type as i16);
.bind(search_key.script.hash_type.clone() as i16);
match &search_key.script_search_mode {
Some(IndexerSearchMode::Prefix) | None => {
query = query
Expand All @@ -367,7 +367,7 @@ pub async fn get_tx_with_cells(
if let Some(script) = filter.script.as_ref() {
query = query
.bind(script.code_hash.as_bytes())
.bind(script.hash_type as i16);
.bind(script.hash_type.clone() as i16);
// Default prefix search
query = query
.bind(script.args.as_bytes())
Expand Down

0 comments on commit dbaa473

Please sign in to comment.