X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=blobdiff_plain;f=lightning-c-bindings%2Fsrc%2Flightning%2Fchain%2Fkeysinterface.rs;h=0841758fba20fe5c6323013f15c7bbcd594c5c47;hp=360d33ef1fb2d64395b1beb89c2f90c6a01955f5;hb=23b946be5cf633afdba94e12fd71380cafdf49be;hpb=b33cce1a6255564b88e0615eb5c7941bd7b15759 diff --git a/lightning-c-bindings/src/lightning/chain/keysinterface.rs b/lightning-c-bindings/src/lightning/chain/keysinterface.rs index 360d33e..0841758 100644 --- a/lightning-c-bindings/src/lightning/chain/keysinterface.rs +++ b/lightning-c-bindings/src/lightning/chain/keysinterface.rs @@ -999,6 +999,11 @@ pub struct KeysInterface { /// blindly signing the hash. #[must_use] pub sign_invoice: extern "C" fn (this_arg: *const c_void, invoice_preimage: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ, + /// Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + /// + /// This method must return the same value each time it is called. + #[must_use] + pub get_inbound_payment_key_material: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes, /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, @@ -1016,6 +1021,7 @@ pub(crate) extern "C" fn KeysInterface_clone_fields(orig: &KeysInterface) -> Key get_secure_random_bytes: Clone::clone(&orig.get_secure_random_bytes), read_chan_signer: Clone::clone(&orig.read_chan_signer), sign_invoice: Clone::clone(&orig.sign_invoice), + get_inbound_payment_key_material: Clone::clone(&orig.get_inbound_payment_key_material), free: Clone::clone(&orig.free), } } @@ -1055,6 +1061,10 @@ impl rustKeysInterface for KeysInterface { let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } + fn get_inbound_payment_key_material(&self) -> lightning::chain::keysinterface::KeyMaterial { + let mut ret = (self.get_inbound_payment_key_material)(self.this_arg); + ::lightning::chain::keysinterface::KeyMaterial(ret.data) + } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -1282,6 +1292,15 @@ pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &InMemorySigne crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false } } +/// Whether anchors should be used. +/// Will panic if ready_channel wasn't called. +#[must_use] +#[no_mangle] +pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &InMemorySigner) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opt_anchors(); + ret +} + /// Sign the single input of spend_tx at index `input_idx` which spends the output /// described by descriptor, returning the witness stack for the input. /// @@ -1635,6 +1654,7 @@ pub extern "C" fn KeysManager_as_KeysInterface(this_arg: &KeysManager) -> crate: get_secure_random_bytes: KeysManager_KeysInterface_get_secure_random_bytes, read_chan_signer: KeysManager_KeysInterface_read_chan_signer, sign_invoice: KeysManager_KeysInterface_sign_invoice, + get_inbound_payment_key_material: KeysManager_KeysInterface_get_inbound_payment_key_material, } } @@ -1644,6 +1664,11 @@ extern "C" fn KeysManager_KeysInterface_get_node_secret(this_arg: *const c_void) crate::c_types::SecretKey::from_rust(ret) } #[must_use] +extern "C" fn KeysManager_KeysInterface_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes { + let mut ret = >::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); + crate::c_types::ThirtyTwoBytes { data: ret.0 } +} +#[must_use] extern "C" fn KeysManager_KeysInterface_get_destination_script(this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z { let mut ret = >::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); ret.into_bytes().into()