This commit is contained in:
J. Ayo Akinyele 2019-08-12 22:47:21 -04:00
parent 973265508d
commit c5c475dfe6
2 changed files with 9 additions and 13 deletions

View File

@ -58,11 +58,11 @@ class Libbolt(object):
self.lib.ffishim_bidirectional_pay_verify_payment_token.argtypes = (c_void_p, c_void_p)
self.lib.ffishim_bidirectional_pay_verify_payment_token.restype = c_void_p
self.lib.ffishim_bidirectional_customer_refund.argtypes = (c_void_p, c_void_p)
self.lib.ffishim_bidirectional_customer_refund.restype = c_void_p
self.lib.ffishim_bidirectional_customer_close.argtypes = (c_void_p, c_void_p)
self.lib.ffishim_bidirectional_customer_close.restype = c_void_p
# self.lib.ffishim_bidirectional_merchant_refund.argtypes = (c_void_p, c_void_p, c_void_p, c_void_p, c_void_p, c_void_p)
# self.lib.ffishim_bidirectional_merchant_refund.restype = c_void_p
# self.lib.ffishim_bidirectional_merchant_close.argtypes = (c_void_p, c_void_p, c_void_p, c_void_p, c_void_p, c_void_p)
# self.lib.ffishim_bidirectional_merchant_close.restype = c_void_p
#
# self.lib.ffishim_bidirectional_resolve.argtypes = (c_void_p, c_void_p, c_void_p, c_void_p, c_void_p)
# self.lib.ffishim_bidirectional_resolve.restype = c_void_p
@ -142,8 +142,8 @@ class Libbolt(object):
# CLOSE
def bidirectional_customer_refund(self, channel_state, cust_wallet):
output_string = self.lib.ffishim_bidirectional_customer_refund(channel_state.encode(), cust_wallet.encode())
def bidirectional_customer_close(self, channel_state, cust_wallet):
output_string = self.lib.ffishim_bidirectional_customer_close(channel_state.encode(), cust_wallet.encode())
output_dictionary = ast.literal_eval(ctypes.cast(output_string, ctypes.c_char_p).value.decode('utf-8'))
return output_dictionary['cust_close']
@ -247,6 +247,6 @@ print("Revoke token: ", revoke_token)
(pay_token, merch_wallet) = libbolt.bidirectional_pay_verify_revoke_token(revoke_token, merch_wallet)
print("Pay token: ", pay_token)
cust_close_msg = libbolt.bidirectional_customer_refund(channel_state, cust_wallet)
cust_close_msg = libbolt.bidirectional_customer_close(channel_state, cust_wallet)
print("Cust close msg: ", cust_close_msg)
print("<========================================>")

View File

@ -201,9 +201,9 @@ pub struct RevokedMessage {
}
impl RevokedMessage {
pub fn new(_msgtype: String, _wpk: secp256k1::PublicKey) -> RevokedMessage { // _sig: Option<[u8; 64]>
pub fn new(_msgtype: String, _wpk: secp256k1::PublicKey) -> RevokedMessage {
RevokedMessage {
msgtype: _msgtype, wpk: _wpk // , sig: _sig
msgtype: _msgtype, wpk: _wpk
}
}
@ -213,10 +213,6 @@ impl RevokedMessage {
input_buf.extend_from_slice(self.msgtype.as_bytes());
v.push(hash_to_fr::<E>(input_buf));
v.push(hash_pubkey_to_fr::<E>(&self.wpk));
//if !self.sig.is_none() {
// v.push(hash_buffer_to_fr::<E>(&self.msgtype, &self.sig.unwrap()));
//}
return v;
}