Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gagliardetto committed May 7, 2024
1 parent 594c137 commit b35c358
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jsonParsed-linux: build-rust-wrapper
cp txstatus/target/x86_64-unknown-linux-gnu/release/libdemo_transaction_status_ffi.a ./txstatus/lib/libsolana_transaction_status_wrapper.a
LD_FLAGS="$(BASE_LD_FLAGS) -extldflags -static"
go build -ldflags=$(LD_FLAGS) -tags ffi -o ./bin/faithful-cli_jsonParsed .
echo "built old-faithful with jsonParsed format support via ffi (rust)"
echo "SUCCESS: built old-faithful with jsonParsed format support via ffi (rust)"
compile:
@echo "\nCompiling faithful-cli binary for current platform ..."
go build -ldflags="$(BASE_LD_FLAGS)" -o ./bin/faithful-cli .
Expand Down
27 changes: 8 additions & 19 deletions txstatus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub extern "C" fn parse_instruction(bytes: *const u8, len: usize) -> Response {
}
}

let parsed_account_keys: Combined;
let static_account_keys_len = decoder.read_u8().unwrap() as usize;
// println!(
// "[rust] static_account_keys_len: {:?}",
Expand All @@ -60,7 +59,7 @@ pub extern "C" fn parse_instruction(bytes: *const u8, len: usize) -> Response {
}

let has_dynamic_account_keys = decoder.read_option().unwrap();
if has_dynamic_account_keys {
let parsed_account_keys: Combined = if has_dynamic_account_keys {
let mut loaded_addresses = LoadedAddresses::default();
let num_writable_accounts = decoder.read_u8().unwrap() as usize;
// println!("[rust] num_writable_accounts: {:?}", num_writable_accounts);
Expand All @@ -80,19 +79,17 @@ pub extern "C" fn parse_instruction(bytes: *const u8, len: usize) -> Response {
loaded_addresses.readonly.push(account_key);
}

parsed_account_keys = Combined {
Combined {
parent: static_account_keys_vec,
child: Some(loaded_addresses),
};
}
} else {
parsed_account_keys = Combined {
Combined {
parent: static_account_keys_vec,
child: None,
};
}
let sommmm = &parsed_account_keys
.child
.unwrap_or(LoadedAddresses::default());
}
};
let sommmm = &parsed_account_keys.child.unwrap_or_default();

let account_keys = AccountKeys::new(
&parsed_account_keys.parent,
Expand Down Expand Up @@ -199,16 +196,8 @@ struct Buffer {
len: usize,
}

#[derive(Default)]
struct Combined {
parent: Vec<Pubkey>,
child: Option<LoadedAddresses>,
}

impl Default for Combined {
fn default() -> Self {
Combined {
parent: vec![],
child: None,
}
}
}

0 comments on commit b35c358

Please sign in to comment.