【发布时间】:2018-07-08 19:16:38
【问题描述】:
我正在尝试在 Rust 中使用 secp256k1 库。我有一个简单的测试程序无法编译,因为它找不到generate_keypair:
extern crate secp256k1;
extern crate rand;
use secp256k1::{Secp256k1, ContextFlag};
use rand::{thread_rng};
fn main() {
let full = Secp256k1::with_caps(ContextFlag::Full);
let (sk, pk) = full.generate_keypair(&mut thread_rng()).unwrap();
}
编译失败,报错:
error[E0599]: no method named `generate_keypair` found for type `secp256k1::Secp256k1` in the current scope
--> src/main.rs:9:25
|
9 | let (sk, pk) = full.generate_keypair(&mut thread_rng()).unwrap();
| ^^^^^^^^^^^^^^^^
据我所知,我使用的库类似于 how its used in the library's tests。
我已将 rand 回滚到 0.3,将 secp256k1 回滚到 0.6,现在它可以工作了。我对为什么现在被打破的任何想法感兴趣。
【问题讨论】:
标签: rust