mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-12 05:59:23 +00:00
Document Bitcoin RPC and make it more robust
This commit is contained in:
@@ -13,7 +13,11 @@ use frost::{
|
||||
tests::{algorithm_machines, key_gen, sign},
|
||||
};
|
||||
|
||||
use crate::{crypto::{x_only, make_even}, algorithm::Schnorr};
|
||||
use crate::{
|
||||
crypto::{x_only, make_even},
|
||||
algorithm::Schnorr,
|
||||
rpc::Rpc,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_algorithm() {
|
||||
@@ -25,7 +29,8 @@ fn test_algorithm() {
|
||||
*keys = keys.offset(Scalar::from(offset));
|
||||
}
|
||||
|
||||
let algo = Schnorr::<RecommendedTranscript>::new(RecommendedTranscript::new(b"bitcoin-serai sign test"));
|
||||
let algo =
|
||||
Schnorr::<RecommendedTranscript>::new(RecommendedTranscript::new(b"bitcoin-serai sign test"));
|
||||
let sig = sign(
|
||||
&mut OsRng,
|
||||
algo.clone(),
|
||||
@@ -42,3 +47,14 @@ fn test_algorithm() {
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_rpc() {
|
||||
let rpc = Rpc::new("http://serai:seraidex@127.0.0.1:18443".to_string()).await.unwrap();
|
||||
|
||||
let latest = rpc.get_latest_block_number().await.unwrap();
|
||||
assert_eq!(
|
||||
rpc.get_block_number(&rpc.get_block_hash(latest).await.unwrap()).await.unwrap(),
|
||||
latest
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user