Compare commits

..

No commits in common. "148abd95d0fcce4b4a5a0569a9bedd55a17b8140" and "37b485288d0cf8999e35c24382dd9c69a4a4a00a" have entirely different histories.

3 changed files with 64 additions and 86 deletions

View file

@ -1643,7 +1643,6 @@ pub extern "C" fn rust_wrapper_create_transaction(
sapoutput_len: usize, sapoutput_len: usize,
net: bool, net: bool,
bl_height: u32, bl_height: u32,
build: bool,
out: *mut u8, out: *mut u8,
out_len: &mut usize){ out_len: &mut usize){
let sap_wit_in: Vec<u8> = marshall_from_haskell_var(sap_wit, sap_wit_len, RW); let sap_wit_in: Vec<u8> = marshall_from_haskell_var(sap_wit, sap_wit_len, RW);
@ -1795,7 +1794,6 @@ pub extern "C" fn rust_wrapper_create_transaction(
} }
} }
} }
if build {
let spend_params_in: Vec<u8> = marshall_from_haskell_var(sapspend, sapspend_len, RW); let spend_params_in: Vec<u8> = marshall_from_haskell_var(sapspend, sapspend_len, RW);
let spend_params_reader = Cursor::new(spend_params_in); let spend_params_reader = Cursor::new(spend_params_in);
let spend_prover = SpendParameters::read(spend_params_reader, false).unwrap(); let spend_prover = SpendParameters::read(spend_params_reader, false).unwrap();
@ -1863,21 +1861,4 @@ pub extern "C" fn rust_wrapper_create_transaction(
} }
} }
} }
} else {
let result = if net {
main_builder.get_fee(&FeeRule::standard())
} else {
test_builder.get_fee(&FeeRule::standard())
};
match result {
Ok(r) => {
let x = Hhex {bytes: r.to_i64_le_bytes().to_vec()};
marshall_to_haskell_var(&x, out, out_len, RW);
},
Err(e) => {
let x = Hhex {bytes: vec![2]};
marshall_to_haskell_var(&x, out, out_len, RW);
}
}
}
} }

View file

@ -287,7 +287,6 @@ import ZcashHaskell.Types
, toBorshVar* `BS.ByteString'& , toBorshVar* `BS.ByteString'&
, `Bool' , `Bool'
, `Word64' , `Word64'
, `Bool'
, getVarBuffer `Buffer HexString'& , getVarBuffer `Buffer HexString'&
} }
-> `()' -> `()'

View file

@ -133,9 +133,8 @@ createTransaction ::
-> SaplingOutputParams -- ^ the Sapling circuit output parameters -> SaplingOutputParams -- ^ the Sapling circuit output parameters
-> ZcashNet -- ^ the network to be used -> ZcashNet -- ^ the network to be used
-> Int -- ^ target block height -> Int -- ^ target block height
-> Bool -- ^ True to build, False to estimate fee
-> Either TxError HexString -> Either TxError HexString
createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing sParams oParams znet bh build = createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing sParams oParams znet bh =
if BS.length (hexBytes txResult) > 1 if BS.length (hexBytes txResult) > 1
then Right txResult then Right txResult
else case head (BS.unpack $ hexBytes txResult) of else case head (BS.unpack $ hexBytes txResult) of
@ -169,4 +168,3 @@ createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing sParams oPa
(sapOParams oParams) (sapOParams oParams)
(znet == MainNet) (znet == MainNet)
(fromIntegral bh) (fromIntegral bh)
build