Upgrade bitcoin and bdk to latest version

The latest version allows us to access `miniscript` via `bdk` which
removes the need for declaring it as an extra dependency.
This commit is contained in:
Thomas Eizinger 2021-10-07 12:26:51 +11:00
parent 9ea73a8e66
commit 4de8b0ebc4
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
9 changed files with 125 additions and 368 deletions

464
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -15,9 +15,9 @@ async-trait = "0.1"
atty = "0.2" atty = "0.2"
backoff = { version = "0.3", features = [ "tokio" ] } backoff = { version = "0.3", features = [ "tokio" ] }
base64 = "0.13" base64 = "0.13"
bdk = "0.10" bdk = "0.12"
big-bytes = "1" big-bytes = "1"
bitcoin = { version = "0.26", features = [ "rand", "use-serde" ] } bitcoin = { version = "0.27", features = [ "rand", "use-serde" ] }
bmrng = "0.5" bmrng = "0.5"
comfy-table = "4.1.1" comfy-table = "4.1.1"
config = { version = "0.11", default-features = false, features = [ "toml" ] } config = { version = "0.11", default-features = false, features = [ "toml" ] }
@ -32,7 +32,6 @@ futures = { version = "0.3", default-features = false }
hex = "0.4" hex = "0.4"
itertools = "0.10" itertools = "0.10"
libp2p = { git = "https://github.com/comit-network/rust-libp2p", branch = "rendezvous", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous" ] } libp2p = { git = "https://github.com/comit-network/rust-libp2p", branch = "rendezvous", default-features = false, features = [ "tcp-tokio", "yamux", "mplex", "dns-tokio", "noise", "request-response", "websocket", "ping", "rendezvous" ] }
miniscript = { version = "5", features = [ "serde" ] }
monero = { version = "0.12", features = [ "serde_support" ] } monero = { version = "0.12", features = [ "serde_support" ] }
monero-rpc = { path = "../monero-rpc" } monero-rpc = { path = "../monero-rpc" }
pem = "0.8" pem = "0.8"
@ -76,7 +75,6 @@ tokio-tar = "0.3"
zip = "0.5" zip = "0.5"
[dev-dependencies] [dev-dependencies]
bdk-testutils = { version = "0.4" }
bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs" } bitcoin-harness = { git = "https://github.com/coblox/bitcoin-harness-rs" }
get-port = "3" get-port = "3"
hyper = "0.14" hyper = "0.14"

View File

@ -29,12 +29,12 @@ use ::bitcoin::hashes::hex::ToHex;
use ::bitcoin::hashes::Hash; use ::bitcoin::hashes::Hash;
use ::bitcoin::{secp256k1, SigHash}; use ::bitcoin::{secp256k1, SigHash};
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use bdk::miniscript::descriptor::Wsh;
use bdk::miniscript::{Descriptor, Segwitv0};
use ecdsa_fun::adaptor::{Adaptor, HashTranscript}; use ecdsa_fun::adaptor::{Adaptor, HashTranscript};
use ecdsa_fun::fun::Point; use ecdsa_fun::fun::Point;
use ecdsa_fun::nonce::Deterministic; use ecdsa_fun::nonce::Deterministic;
use ecdsa_fun::ECDSA; use ecdsa_fun::ECDSA;
use miniscript::descriptor::Wsh;
use miniscript::{Descriptor, Segwitv0};
use rand::{CryptoRng, RngCore}; use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sha2::Sha256; use sha2::Sha256;
@ -215,7 +215,8 @@ pub fn build_shared_output_descriptor(A: Point, B: Point) -> Descriptor<bitcoin:
let miniscript = MINISCRIPT_TEMPLATE.replace("A", &A).replace("B", &B); let miniscript = MINISCRIPT_TEMPLATE.replace("A", &A).replace("B", &B);
let miniscript = miniscript::Miniscript::<bitcoin::PublicKey, Segwitv0>::from_str(&miniscript) let miniscript =
bdk::miniscript::Miniscript::<bitcoin::PublicKey, Segwitv0>::from_str(&miniscript)
.expect("a valid miniscript"); .expect("a valid miniscript");
Descriptor::Wsh(Wsh::new(miniscript).expect("a valid descriptor")) Descriptor::Wsh(Wsh::new(miniscript).expect("a valid descriptor"))

View File

@ -6,8 +6,8 @@ use crate::bitcoin::{
use ::bitcoin::util::bip143::SigHashCache; use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{OutPoint, Script, SigHash, SigHashType, TxIn, TxOut, Txid}; use ::bitcoin::{OutPoint, Script, SigHash, SigHashType, TxIn, TxOut, Txid};
use anyhow::Result; use anyhow::Result;
use bdk::miniscript::{Descriptor, DescriptorTrait};
use ecdsa_fun::Signature; use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::cmp::Ordering; use std::cmp::Ordering;
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -6,8 +6,8 @@ use ::bitcoin::util::psbt::PartiallySignedTransaction;
use ::bitcoin::{OutPoint, TxIn, TxOut, Txid}; use ::bitcoin::{OutPoint, TxIn, TxOut, Txid};
use anyhow::{bail, Result}; use anyhow::{bail, Result};
use bdk::database::BatchDatabase; use bdk::database::BatchDatabase;
use bdk::miniscript::{Descriptor, DescriptorTrait};
use bitcoin::Script; use bitcoin::Script;
use miniscript::{Descriptor, DescriptorTrait};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
const SCRIPT_SIZE: usize = 34; const SCRIPT_SIZE: usize = 34;

View File

@ -4,7 +4,7 @@ use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{SigHash, SigHashType}; use ::bitcoin::{SigHash, SigHashType};
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use bdk::bitcoin::Script; use bdk::bitcoin::Script;
use miniscript::{Descriptor, DescriptorTrait}; use bdk::miniscript::{Descriptor, DescriptorTrait};
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Debug)] #[derive(Debug)]

View File

@ -6,12 +6,12 @@ use crate::bitcoin::{
use ::bitcoin::util::bip143::SigHashCache; use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{SigHash, SigHashType, Txid}; use ::bitcoin::{SigHash, SigHashType, Txid};
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use bdk::miniscript::{Descriptor, DescriptorTrait};
use bitcoin::Script; use bitcoin::Script;
use ecdsa_fun::adaptor::{Adaptor, HashTranscript}; use ecdsa_fun::adaptor::{Adaptor, HashTranscript};
use ecdsa_fun::fun::Scalar; use ecdsa_fun::fun::Scalar;
use ecdsa_fun::nonce::Deterministic; use ecdsa_fun::nonce::Deterministic;
use ecdsa_fun::Signature; use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};
use sha2::Sha256; use sha2::Sha256;
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -7,8 +7,8 @@ use crate::{bitcoin, monero};
use ::bitcoin::util::bip143::SigHashCache; use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{Script, SigHash, SigHashType, Txid}; use ::bitcoin::{Script, SigHash, SigHashType, Txid};
use anyhow::{bail, Context, Result}; use anyhow::{bail, Context, Result};
use bdk::miniscript::{Descriptor, DescriptorTrait};
use ecdsa_fun::Signature; use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};
use std::collections::HashMap; use std::collections::HashMap;
#[derive(Debug)] #[derive(Debug)]

View File

@ -607,9 +607,7 @@ impl WalletBuilder {
pub fn build(self) -> Wallet<(), bdk::database::MemoryDatabase, StaticFeeRate> { pub fn build(self) -> Wallet<(), bdk::database::MemoryDatabase, StaticFeeRate> {
use bdk::database::MemoryDatabase; use bdk::database::MemoryDatabase;
use bdk::{ConfirmationTime, LocalUtxo, TransactionDetails}; use bdk::testutils;
use bitcoin::OutPoint;
use testutils::testutils;
let descriptors = testutils!(@descriptors (&format!("wpkh({}/*)", self.key))); let descriptors = testutils!(@descriptors (&format!("wpkh({}/*)", self.key)));