diff --git a/Makefile b/Makefile index 703ee48c..e27e417e 100644 --- a/Makefile +++ b/Makefile @@ -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 . diff --git a/txstatus/src/lib.rs b/txstatus/src/lib.rs index a802d065..27b5d09a 100644 --- a/txstatus/src/lib.rs +++ b/txstatus/src/lib.rs @@ -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: {:?}", @@ -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); @@ -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, @@ -199,16 +196,8 @@ struct Buffer { len: usize, } +#[derive(Default)] struct Combined { parent: Vec, child: Option, } - -impl Default for Combined { - fn default() -> Self { - Combined { - parent: vec![], - child: None, - } - } -}