Update to use commitment trees for anchors
This commit is contained in:
parent
652e95c361
commit
2d14ef6b22
2 changed files with 10 additions and 10 deletions
|
@ -1647,24 +1647,24 @@ pub extern "C" fn rust_wrapper_create_transaction(
|
||||||
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);
|
||||||
let sap_wit_reader = Cursor::new(sap_wit_in);
|
let sap_wit_reader = Cursor::new(sap_wit_in);
|
||||||
let sap_iw: Option<IncrementalWitness<Node, SAPLING_DEPTH>> = read_incremental_witness(sap_wit_reader).ok();
|
let sap_iw = read_commitment_tree::<Node, Cursor<Vec<u8>>, SAPLING_DEPTH>(sap_wit_reader);
|
||||||
let sap_anchor = match sap_iw {
|
let sap_anchor = match sap_iw {
|
||||||
Some(s_iw) => {
|
Ok(s_iw) => {
|
||||||
Some(SaplingAnchor::from(s_iw.root()))
|
Some(SaplingAnchor::from(s_iw.root()))
|
||||||
},
|
},
|
||||||
None => {
|
Err(_e) => {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
println!("{:?}", sap_anchor);
|
println!("{:?}", sap_anchor);
|
||||||
let orch_wit_in: Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW);
|
let orch_wit_in: Vec<u8> = marshall_from_haskell_var(orch_wit, orch_wit_len, RW);
|
||||||
let orch_wit_reader = Cursor::new(orch_wit_in);
|
let orch_wit_reader = Cursor::new(orch_wit_in);
|
||||||
let orch_iw: Option<IncrementalWitness<MerkleHashOrchard, 32>> = read_incremental_witness(orch_wit_reader).ok();
|
let orch_iw = read_commitment_tree::<MerkleHashOrchard, Cursor<Vec<u8>>, 32>(orch_wit_reader);
|
||||||
let orch_anchor = match orch_iw {
|
let orch_anchor = match orch_iw {
|
||||||
Some(o_iw) => {
|
Ok(o_iw) => {
|
||||||
Some(OrchardAnchor::from(o_iw.root()))
|
Some(OrchardAnchor::from(o_iw.root()))
|
||||||
},
|
},
|
||||||
None => {
|
Err(_e) => {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -123,8 +123,8 @@ readZebraTransaction hex =
|
||||||
rawTx = (withPureBorshVarBuffer . rustWrapperTxRead) $ hexBytes hex
|
rawTx = (withPureBorshVarBuffer . rustWrapperTxRead) $ hexBytes hex
|
||||||
|
|
||||||
createTransaction ::
|
createTransaction ::
|
||||||
Maybe SaplingWitness -- ^ to obtain the Sapling anchor
|
Maybe SaplingCommitmentTree -- ^ to obtain the Sapling anchor
|
||||||
-> Maybe OrchardWitness -- ^ to obtain the Orchard anchor
|
-> Maybe OrchardCommitmentTree -- ^ to obtain the Orchard anchor
|
||||||
-> [TransparentTxSpend] -- ^ the list of transparent notes to spend
|
-> [TransparentTxSpend] -- ^ the list of transparent notes to spend
|
||||||
-> [SaplingTxSpend] -- ^ the list of Sapling notes to spend
|
-> [SaplingTxSpend] -- ^ the list of Sapling notes to spend
|
||||||
-> [OrchardTxSpend] -- ^ the list of Orchard notes to spend
|
-> [OrchardTxSpend] -- ^ the list of Orchard notes to spend
|
||||||
|
@ -156,10 +156,10 @@ createTransaction sapAnchor orchAnchor tSpend sSpend oSpend outgoing sParams oPa
|
||||||
rustWrapperCreateTx
|
rustWrapperCreateTx
|
||||||
(case sapAnchor of
|
(case sapAnchor of
|
||||||
Nothing -> "0"
|
Nothing -> "0"
|
||||||
Just sA -> toBytes $ sapWit sA)
|
Just sA -> toBytes $ sapTree sA)
|
||||||
(case orchAnchor of
|
(case orchAnchor of
|
||||||
Nothing -> "0"
|
Nothing -> "0"
|
||||||
Just oA -> toBytes $ orchWit oA)
|
Just oA -> toBytes $ orchTree oA)
|
||||||
tSpend
|
tSpend
|
||||||
sSpend
|
sSpend
|
||||||
oSpend
|
oSpend
|
||||||
|
|
Loading…
Reference in a new issue