diff --git a/Cargo.toml b/Cargo.toml index e11c9b8..f628809 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,9 @@ curve25519-dalek = { version = "1", features = ["serde"] } merlin = "1.0.0" bulletproofs = { git = "https://github.com/dalek-cryptography/bulletproofs", tag = "1.0.2" } sha2 = { version = "0.8", default-features = false } +#wagyu-bitcoin = { git = "https://github.com/ArgusHQ/wagyu", branch = "feature/bitcoin-transactions" } +#wagyu-ethereum = { git = "https://github.com/ArgusHQ/wagyu", branch = "feature/ethereum-transactions" } +wagyu-zcash = { git = "https://github.com/ArgusHQ/wagyu", branch = "feature/zcash-transactions" } [dev-dependencies.bincode] version = "~0.6.0" diff --git a/py/tests.py b/py/tests.py index 317d226..8206f64 100644 --- a/py/tests.py +++ b/py/tests.py @@ -11,7 +11,7 @@ def malformed_token(token): token_dict = ast.literal_eval(token) updated_token = {} for k,v in token_dict.items(): - updated_token[k] = rand_hex(1) + v[1:] + updated_token[k] = v[:-4] + rand_hex(4) return json.dumps(updated_token) class BoltEstablishTests(unittest.TestCase): diff --git a/src/ffishim.rs b/src/ffishim.rs index 4602c4d..d7adb09 100644 --- a/src/ffishim.rs +++ b/src/ffishim.rs @@ -44,15 +44,15 @@ pub mod ffishim { // let string: &str = str::from_utf8(bytes).unwrap(); // make sure the bytes are UTF-8 // serde_json::from_str(&string).unwrap() // } - - fn deserialize_optional_object<'a, T>(serialized: *mut c_char) -> Option - where - T: Deserialize<'a>, - { - let bytes = unsafe { CStr::from_ptr(serialized).to_bytes() }; - let string: &str = str::from_utf8(bytes).unwrap(); // make sure the bytes are UTF-8 - Some(serde_json::from_str(&string).unwrap()) - } +// +// fn deserialize_optional_object<'a, T>(serialized: *mut c_char) -> Option +// where +// T: Deserialize<'a>, +// { +// let bytes = unsafe { CStr::from_ptr(serialized).to_bytes() }; +// let string: &str = str::from_utf8(bytes).unwrap(); // make sure the bytes are UTF-8 +// Some(serde_json::from_str(&string).unwrap()) +// } fn deserialize_result_object<'a, T>(serialized: *mut c_char) -> ResultSerdeType where @@ -467,7 +467,7 @@ pub mod ffishim { let merch_close_result: ResultSerdeType = deserialize_result_object(ser_merch_close); let merch_close = handle_errors!(merch_close_result); - let revoke_token_valid = bidirectional::wtp_verify_revoke_message(&channel_token, &wpk, &merch_close.revoke.unwrap()); + let revoke_token_valid = bidirectional::wtp_verify_revoke_message(&wpk, &merch_close.revoke.unwrap()); let merch_close_valid = bidirectional::wtp_verify_merch_close_message(&channel_token, &merch_close); let token_valid = revoke_token_valid && merch_close_valid; diff --git a/src/lib.rs b/src/lib.rs index dbfef4a..dffb87a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -471,7 +471,7 @@ pub mod bidirectional { /// /// Used in merch-close WTP for validating that revoke_token is a valid signature under and the message /// - pub fn wtp_verify_revoke_message(channel_token: &ChannelToken, wpk: &secp256k1::PublicKey, revoke_token: &secp256k1::Signature) -> bool { + pub fn wtp_verify_revoke_message(wpk: &secp256k1::PublicKey, revoke_token: &secp256k1::Signature) -> bool { let secp = secp256k1::Secp256k1::verification_only(); let revoke_msg = RevokedMessage::new(String::from("revoked"), wpk.clone()); let msg = secp256k1::Message::from_slice(&revoke_msg.hash_to_slice()).unwrap();