]> git.bitcoin.ninja Git - rust-lightning/commitdiff
[bindings] Use global context for secp256k1
authorMatt Corallo <git@bluematt.me>
Mon, 1 Feb 2021 05:09:50 +0000 (00:09 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 1 Mar 2021 00:44:45 +0000 (19:44 -0500)
Note that this uses https://github.com/rust-bitcoin/rust-secp256k1/pull/279

c-bindings-gen/src/types.rs
lightning-c-bindings/Cargo.toml

index e7244039f4bcc5a32ab230b9f0a22640c56f28fd..7fc7e4cd905cff8d1cc66cd39aba44988b38c535 100644 (file)
@@ -587,7 +587,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
        /// Returns true we if can just skip passing this to C entirely
        fn no_arg_path_to_rust(&self, full_path: &str) -> &str {
                if full_path == "bitcoin::secp256k1::Secp256k1" {
-                       "&bitcoin::secp256k1::Secp256k1::new()"
+                       "secp256k1::SECP256K1"
                } else { unimplemented!(); }
        }
 
index 7c569abc7e35868e0a96f9fa79f4206270000666..9f7210386b629ad4c10be009129a8673180a1bff 100644 (file)
@@ -16,8 +16,13 @@ crate-type = ["staticlib"
 
 [dependencies]
 bitcoin = "0.26"
+secp256k1 = { version = "0.20.1", features = ["global-context-less-secure"] }
 lightning = { version = "0.0.12", path = "../lightning" }
 
+[patch.crates-io]
+# Rust-Secp256k1 PR 279. Should be dropped once merged.
+secp256k1 = { git = 'https://github.com/TheBlueMatt/rust-secp256k1', rev = '15a0d4195a20355f6b1e8f54c84eba56abc15cbd' }
+
 # We eventually want to join the root workspace, but for now, the bindings generation is
 # a bit brittle and we don't want to hold up other developers from making changes just
 # because they break the bindings