Skip to content

Commit 37876a7

Browse files
committed
secp256k1-sys: fix lowmemory feature
When upstream switched to multicomb they changed the #define flags needed to reduce the size of the ecmult_gen precomp table. We should have updated our bulid.rs. Before this change, on my system the secp256k1-sys rlib with the lowmemory feature has size 630602. After this change, it has size 610090, a 3.3% reduction. Probably not worth backporting, although it's not a breaking change and we totally could backport it. Fixes rust-bitcoin#795
1 parent 2038b5e commit 37876a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

secp256k1-sys/build.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ fn main() {
3535

3636
if cfg!(feature = "lowmemory") {
3737
base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume negligible memory
38-
base_config.define("ECMULT_GEN_PREC_BITS", Some("2"));
38+
base_config.define("COMB_BLOCKS", Some("2"));
39+
base_config.define("COMB_TEETH", Some("5"));
3940
} else {
40-
base_config.define("ECMULT_GEN_PREC_BITS", Some("4"));
4141
base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`)
42+
base_config.define("COMB_BLOCKS", Some("43"));
43+
base_config.define("COMB_TEETH", Some("6"));
4244
}
4345
base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1"));
4446
#[cfg(feature = "recovery")]

0 commit comments

Comments
 (0)