More clean up
This commit is contained in:
parent
2515937ea0
commit
cb44a31529
|
@ -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"
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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<T>
|
||||
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<T>
|
||||
// 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<T>
|
||||
where
|
||||
|
@ -467,7 +467,7 @@ pub mod ffishim {
|
|||
let merch_close_result: ResultSerdeType<bidirectional::ChannelcloseM> = 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;
|
||||
|
||||
|
|
|
@ -471,7 +471,7 @@ pub mod bidirectional {
|
|||
///
|
||||
/// Used in merch-close WTP for validating that revoke_token is a valid signature under <wpk> and the <revoked || wpk> message
|
||||
///
|
||||
pub fn wtp_verify_revoke_message<E: Engine>(channel_token: &ChannelToken<E>, 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();
|
||||
|
|
Loading…
Reference in New Issue