@@ -629,7 +629,7 @@ pub struct ChannelSigner {
629
629
#[ must_use]
630
630
pub validate_holder_commitment : extern "C" fn ( this_arg : * const c_void , holder_tx : & crate :: lightning:: ln:: chan_utils:: HolderCommitmentTransaction , preimages : crate :: c_types:: derived:: CVec_PaymentPreimageZ ) -> crate :: c_types:: derived:: CResult_NoneNoneZ ,
631
631
/// Returns the holder's channel public keys and basepoints.
632
- pub pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys ,
632
+ pub pubkeys : core :: cell :: UnsafeCell < crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys > ,
633
633
/// Fill in the pubkeys field as a reference to it will be given to Rust after this returns
634
634
/// Note that this takes a pointer to this object, not the this_ptr like other methods do
635
635
/// This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating.
@@ -662,7 +662,7 @@ pub(crate) extern "C" fn ChannelSigner_clone_fields(orig: &ChannelSigner) -> Cha
662
662
get_per_commitment_point : Clone :: clone ( & orig. get_per_commitment_point ) ,
663
663
release_commitment_secret : Clone :: clone ( & orig. release_commitment_secret ) ,
664
664
validate_holder_commitment : Clone :: clone ( & orig. validate_holder_commitment ) ,
665
- pubkeys : Clone :: clone ( & orig. pubkeys ) ,
665
+ pubkeys : Clone :: clone ( unsafe { & * core :: cell :: UnsafeCell :: get ( & orig. pubkeys ) } ) . into ( ) ,
666
666
set_pubkeys : Clone :: clone ( & orig. set_pubkeys ) ,
667
667
channel_keys_id : Clone :: clone ( & orig. channel_keys_id ) ,
668
668
provide_channel_parameters : Clone :: clone ( & orig. provide_channel_parameters ) ,
@@ -690,7 +690,7 @@ impl rustChannelSigner for ChannelSigner {
690
690
if let Some ( f) = self . set_pubkeys {
691
691
( f) ( & self ) ;
692
692
}
693
- self . pubkeys . get_native_ref ( )
693
+ unsafe { & * self . pubkeys . get ( ) } . get_native_ref ( )
694
694
}
695
695
fn channel_keys_id ( & self ) -> [ u8 ; 32 ] {
696
696
let mut ret = ( self . channel_keys_id ) ( self . this_arg ) ;
@@ -889,7 +889,7 @@ impl lightning::chain::keysinterface::ChannelSigner for EcdsaChannelSigner {
889
889
if let Some ( f) = self . ChannelSigner . set_pubkeys {
890
890
( f) ( & self . ChannelSigner ) ;
891
891
}
892
- self . ChannelSigner . pubkeys . get_native_ref ( )
892
+ unsafe { & * self . ChannelSigner . pubkeys . get ( ) } . get_native_ref ( )
893
893
}
894
894
fn channel_keys_id ( & self ) -> [ u8 ; 32 ] {
895
895
let mut ret = ( self . ChannelSigner . channel_keys_id ) ( self . ChannelSigner . this_arg ) ;
@@ -1066,7 +1066,7 @@ impl lightning::chain::keysinterface::ChannelSigner for WriteableEcdsaChannelSig
1066
1066
if let Some ( f) = self . EcdsaChannelSigner . ChannelSigner . set_pubkeys {
1067
1067
( f) ( & self . EcdsaChannelSigner . ChannelSigner ) ;
1068
1068
}
1069
- self . EcdsaChannelSigner . ChannelSigner . pubkeys . get_native_ref ( )
1069
+ unsafe { & * self . EcdsaChannelSigner . ChannelSigner . pubkeys . get ( ) } . get_native_ref ( )
1070
1070
}
1071
1071
fn channel_keys_id ( & self ) -> [ u8 ; 32 ] {
1072
1072
let mut ret = ( self . EcdsaChannelSigner . ChannelSigner . channel_keys_id ) ( self . EcdsaChannelSigner . ChannelSigner . this_arg ) ;
@@ -1761,7 +1761,7 @@ pub extern "C" fn InMemorySigner_as_ChannelSigner(this_arg: &InMemorySigner) ->
1761
1761
release_commitment_secret : InMemorySigner_ChannelSigner_release_commitment_secret ,
1762
1762
validate_holder_commitment : InMemorySigner_ChannelSigner_validate_holder_commitment ,
1763
1763
1764
- pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys { inner : core:: ptr:: null_mut ( ) , is_owned : true } ,
1764
+ pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys { inner : core:: ptr:: null_mut ( ) , is_owned : true } . into ( ) ,
1765
1765
set_pubkeys : Some ( InMemorySigner_ChannelSigner_set_pubkeys ) ,
1766
1766
channel_keys_id : InMemorySigner_ChannelSigner_channel_keys_id ,
1767
1767
provide_channel_parameters : InMemorySigner_ChannelSigner_provide_channel_parameters ,
@@ -1793,8 +1793,8 @@ extern "C" fn InMemorySigner_ChannelSigner_pubkeys(this_arg: *const c_void) -> c
1793
1793
extern "C" fn InMemorySigner_ChannelSigner_set_pubkeys ( trait_self_arg : & ChannelSigner ) {
1794
1794
// This is a bit race-y in the general case, but for our specific use-cases today, we're safe
1795
1795
// Specifically, we must ensure that the first time we're called it can never be in parallel
1796
- if trait_self_arg. pubkeys . inner . is_null ( ) {
1797
- unsafe { & mut * ( trait_self_arg as * const ChannelSigner as * mut ChannelSigner ) } . pubkeys = InMemorySigner_ChannelSigner_pubkeys ( trait_self_arg. this_arg ) ;
1796
+ if unsafe { & * trait_self_arg. pubkeys . get ( ) } . inner . is_null ( ) {
1797
+ * unsafe { & mut * ( & * ( trait_self_arg as * const ChannelSigner ) ) . pubkeys . get ( ) } = InMemorySigner_ChannelSigner_pubkeys ( trait_self_arg. this_arg ) . into ( ) ;
1798
1798
}
1799
1799
}
1800
1800
#[ must_use]
@@ -1839,7 +1839,7 @@ pub extern "C" fn InMemorySigner_as_EcdsaChannelSigner(this_arg: &InMemorySigner
1839
1839
release_commitment_secret : InMemorySigner_ChannelSigner_release_commitment_secret ,
1840
1840
validate_holder_commitment : InMemorySigner_ChannelSigner_validate_holder_commitment ,
1841
1841
1842
- pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys { inner : core:: ptr:: null_mut ( ) , is_owned : true } ,
1842
+ pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys { inner : core:: ptr:: null_mut ( ) , is_owned : true } . into ( ) ,
1843
1843
set_pubkeys : Some ( InMemorySigner_ChannelSigner_set_pubkeys ) ,
1844
1844
channel_keys_id : InMemorySigner_ChannelSigner_channel_keys_id ,
1845
1845
provide_channel_parameters : InMemorySigner_ChannelSigner_provide_channel_parameters ,
@@ -1939,7 +1939,7 @@ pub extern "C" fn InMemorySigner_as_WriteableEcdsaChannelSigner(this_arg: &InMem
1939
1939
release_commitment_secret : InMemorySigner_ChannelSigner_release_commitment_secret ,
1940
1940
validate_holder_commitment : InMemorySigner_ChannelSigner_validate_holder_commitment ,
1941
1941
1942
- pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys { inner : core:: ptr:: null_mut ( ) , is_owned : true } ,
1942
+ pubkeys : crate :: lightning:: ln:: chan_utils:: ChannelPublicKeys { inner : core:: ptr:: null_mut ( ) , is_owned : true } . into ( ) ,
1943
1943
set_pubkeys : Some ( InMemorySigner_ChannelSigner_set_pubkeys ) ,
1944
1944
channel_keys_id : InMemorySigner_ChannelSigner_channel_keys_id ,
1945
1945
provide_channel_parameters : InMemorySigner_ChannelSigner_provide_channel_parameters ,
0 commit comments