Support secp256k1 RecoverableSignatures
[ldk-c-bindings] / c-bindings-gen / src / types.rs
index 99fafd490a065450dd93fc282e29144e47ccc058..1b3810878e782e86c9fc43353e4fbda96ef9226b 100644 (file)
@@ -558,7 +558,6 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr
        pub fn resolve_imported_refs(&self, mut ty: syn::Type) -> syn::Type {
                match &mut ty {
                        syn::Type::Path(p) => {
-eprintln!("rir {:?}", p);
                                if p.path.segments.len() != 1 { unimplemented!(); }
                                let mut args = p.path.segments[0].arguments.clone();
                                if let syn::PathArguments::AngleBracketed(ref mut generics) = &mut args {
@@ -782,6 +781,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                match ty {
                        "()" => true,
                        "crate::c_types::Signature" => true,
+                       "crate::c_types::RecoverableSignature" => true,
                        "crate::c_types::TxOut" => true,
                        _ => false,
                }
@@ -820,6 +820,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        "bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
                                => Some("crate::c_types::PublicKey"),
                        "bitcoin::secp256k1::Signature" => Some("crate::c_types::Signature"),
+                       "bitcoin::secp256k1::recovery::RecoverableSignature" => Some("crate::c_types::RecoverableSignature"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if is_ref  => Some("*const [u8; 32]"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
@@ -895,6 +896,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                => Some(""),
                        "bitcoin::secp256k1::Signature" if is_ref => Some("&"),
                        "bitcoin::secp256k1::Signature" => Some(""),
+                       "bitcoin::secp256k1::recovery::RecoverableSignature" => Some(""),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if is_ref => Some("&::bitcoin::secp256k1::key::SecretKey::from_slice(&unsafe { *"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
@@ -955,6 +957,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        "bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
                                => Some(".into_rust()"),
                        "bitcoin::secp256k1::Signature" => Some(".into_rust()"),
+                       "bitcoin::secp256k1::recovery::RecoverableSignature" => Some(".into_rust()"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if !is_ref => Some(".into_rust()"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
@@ -1034,6 +1037,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        "bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
                                => Some("crate::c_types::PublicKey::from_rust(&"),
                        "bitcoin::secp256k1::Signature" => Some("crate::c_types::Signature::from_rust(&"),
+                       "bitcoin::secp256k1::recovery::RecoverableSignature" => Some("crate::c_types::RecoverableSignature::from_rust(&"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if is_ref => Some(""),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
@@ -1103,6 +1107,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        "bitcoin::secp256k1::key::PublicKey"|"bitcoin::secp256k1::PublicKey"|"secp256k1::key::PublicKey"
                                => Some(")"),
                        "bitcoin::secp256k1::Signature" => Some(")"),
+                       "bitcoin::secp256k1::recovery::RecoverableSignature" => Some(")"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"
                                if !is_ref => Some(")"),
                        "bitcoin::secp256k1::key::SecretKey"|"bitcoin::secp256k1::SecretKey"