Bitcoin tweaks + cargo update

Removes bitcoin-serai's usage of sha2 for bitcoin-hashes. While sha2 is still
in play due to modular-frost (more specifically, due to ciphersuite), this
offers a bit more performance (assuming equivalency between sha2 and
bitcoin-hashes' impl) due to removing a static for a const.

Makes secp256k1 a dev dependency for bitcoin-serai. While secp256k1 is still
pulled in via bitcoin, it's hopefully slightly better to compile now and makes
usage of secp256k1 an implementation detail of bitcoin (letting it change it
freely).

Also offers slightly more efficient signing as we don't decode to a signature
just to re-encode for the transaction.

Removes a 20s sleep for a check every second, up to 20 times, for reduced test
times in the processor.
This commit is contained in:
Luke Parker
2023-11-06 07:19:55 -05:00
parent bd3272a9f2
commit cddb44ae3f
6 changed files with 182 additions and 169 deletions

View File

@@ -50,9 +50,14 @@ mod bitcoin {
async fn bitcoin(ops: &DockerOperations) -> Bitcoin {
let handle = ops.handle("serai-dev-bitcoin").host_port(8332).unwrap();
// TODO: Replace with a check if the node has booted
tokio::time::sleep(core::time::Duration::from_secs(20)).await;
let bitcoin = Bitcoin::new(format!("http://serai:seraidex@{}:{}", handle.0, handle.1)).await;
let url = format!("http://serai:seraidex@{}:{}", handle.0, handle.1);
for _ in 0 .. 20 {
if bitcoin_serai::rpc::Rpc::new(url.clone()).await.is_ok() {
break;
}
tokio::time::sleep(core::time::Duration::from_secs(1)).await;
}
let bitcoin = Bitcoin::new(url).await;
bitcoin.fresh_chain().await;
bitcoin
}