Compare commits
2 commits
6cf5d85c0b
...
b74cd5f354
Author | SHA1 | Date | |
---|---|---|---|
b74cd5f354 | |||
586cb4646c |
2 changed files with 15 additions and 21 deletions
|
@ -1247,16 +1247,8 @@ pub extern "C" fn rust_wrapper_read_sapling_position(
|
||||||
let wit_in: Vec<u8> = marshall_from_haskell_var(wit, wit_len, RW);
|
let wit_in: Vec<u8> = marshall_from_haskell_var(wit, wit_len, RW);
|
||||||
let wit_reader = Cursor::new(wit_in);
|
let wit_reader = Cursor::new(wit_in);
|
||||||
let iw: IncrementalWitness<Node, SAPLING_DEPTH> = read_incremental_witness(wit_reader).unwrap();
|
let iw: IncrementalWitness<Node, SAPLING_DEPTH> = read_incremental_witness(wit_reader).unwrap();
|
||||||
let path = iw.path();
|
let pos = iw.witnessed_position();
|
||||||
match path {
|
return u64::from(pos);
|
||||||
Some(p) => {
|
|
||||||
let pos = p.position();
|
|
||||||
return u64::from(pos);
|
|
||||||
},
|
|
||||||
None => {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
24
test/Spec.hs
24
test/Spec.hs
|
@ -1113,23 +1113,25 @@ main = do
|
||||||
MainNet
|
MainNet
|
||||||
External
|
External
|
||||||
p
|
p
|
||||||
dn `shouldNotBe` Nothing
|
dn `shouldBe` Nothing
|
||||||
|
|
||||||
describe "Generate an ExchangeAddress (MainNet) from transparent address" $ do
|
describe "Generate an ExchangeAddress (MainNet) from transparent address" $ do
|
||||||
let ta = decodeTransparentAddress "t1dMjvesbzdG41xgKaGU3HgwYJwSgbCK54e"
|
let ta = decodeTransparentAddress "t1dMjvesbzdG41xgKaGU3HgwYJwSgbCK54e"
|
||||||
it "Try to generate valid ExchangeAddress from Transparent Address" $ do
|
it "Try to generate valid ExchangeAddress from Transparent Address" $ do
|
||||||
case ta of
|
case ta of
|
||||||
Nothing -> assertFailure "Failed to decode transparent address"
|
Nothing -> assertFailure "Failed to decode transparent address"
|
||||||
Just t -> do
|
Just t -> do
|
||||||
case (tr_type (ta_receiver t) ) of
|
case (tr_type (ta_receiver t)) of
|
||||||
P2SH -> assertFailure "P2SH not supported for ExchengeAddress generation"
|
P2SH ->
|
||||||
|
assertFailure
|
||||||
|
"P2SH not supported for ExchengeAddress generation"
|
||||||
P2PKH -> do
|
P2PKH -> do
|
||||||
let exch = encodeExchangeAddress (ta_network t) (ta_receiver t)
|
let exch =
|
||||||
|
encodeExchangeAddress (ta_network t) (ta_receiver t)
|
||||||
case exch of
|
case exch of
|
||||||
Nothing -> assertFailure "Failed to encode Exchange address"
|
Nothing -> assertFailure "Failed to encode Exchange address"
|
||||||
Just addr -> do
|
Just addr -> do
|
||||||
let eadr = decodeExchangeAddress addr
|
let eadr = decodeExchangeAddress addr
|
||||||
eadr `shouldNotBe` Nothing
|
eadr `shouldNotBe` Nothing
|
||||||
|
|
||||||
-- | Properties
|
-- | Properties
|
||||||
prop_PhraseLength :: Property
|
prop_PhraseLength :: Property
|
||||||
|
|
Loading…
Reference in a new issue