Rename customer_refund to customer_close
This commit is contained in:
parent
d465dcd630
commit
973265508d
|
@ -312,14 +312,14 @@ pub mod ffishim {
|
|||
// CLOSE
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn ffishim_bidirectional_customer_refund(ser_channel_state: *mut c_char,
|
||||
pub extern fn ffishim_bidirectional_customer_close(ser_channel_state: *mut c_char,
|
||||
ser_cust_wallet: *mut c_char) -> *mut c_char {
|
||||
// Deserialize the channel state
|
||||
let channel_state: bidirectional::ChannelState<Bls12> = deserialize_object(ser_channel_state);
|
||||
// Deserialize the cust wallet
|
||||
let cust_wallet: bidirectional::CustomerWallet<Bls12> = deserialize_object(ser_cust_wallet);
|
||||
|
||||
let cust_close = bidirectional::customer_refund(&channel_state, &cust_wallet);
|
||||
let cust_close = bidirectional::customer_close(&channel_state, &cust_wallet);
|
||||
let ser = ["{\'cust_close\':\'", serde_json::to_string(&cust_close).unwrap().as_str(), "\'}"].concat();
|
||||
let cser = CString::new(ser).unwrap();
|
||||
cser.into_raw()
|
||||
|
|
|
@ -448,10 +448,10 @@ pub mod bidirectional {
|
|||
|
||||
// for customer => on input a wallet w, it outputs a customer channel closure message
|
||||
///
|
||||
/// customer_refund - takes as input the channel state, merchant's verification
|
||||
/// customer_close - takes as input the channel state, merchant's verification
|
||||
/// key, and customer wallet. Generates a channel closure message for customer.
|
||||
///
|
||||
pub fn customer_refund<E: Engine>(channel_state: &ChannelState<E>, cust_wallet: &CustomerWallet<E>) -> ChannelcloseC<E> {
|
||||
pub fn customer_close<E: Engine>(channel_state: &ChannelState<E>, cust_wallet: &CustomerWallet<E>) -> ChannelcloseC<E> {
|
||||
if !channel_state.channel_established {
|
||||
panic!("Cannot close a channel that has not been established!");
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ mod tests {
|
|||
|
||||
println!("Successful payment!");
|
||||
|
||||
let cust_close = bidirectional::customer_refund(&channel_state, &cust_wallet);
|
||||
let cust_close = bidirectional::customer_close(&channel_state, &cust_wallet);
|
||||
println!("Obtained the channel close message");
|
||||
println!("{}", cust_close.message);
|
||||
println!("{}", cust_close.signature);
|
||||
|
@ -716,7 +716,7 @@ mod tests {
|
|||
assert!(cust_wallet.cust_balance == (b0_customer - total_owed) && cust_wallet.merch_balance == total_owed + b0_merchant);
|
||||
}
|
||||
|
||||
let cust_close = bidirectional::customer_refund(&channel_state, &cust_wallet);
|
||||
let cust_close = bidirectional::customer_close(&channel_state, &cust_wallet);
|
||||
println!("Obtained the channel close message");
|
||||
println!("{}", cust_close.message);
|
||||
println!("{}", cust_close.signature);
|
||||
|
|
Loading…
Reference in New Issue