Browse Source

Use itertools exactly_one

bdk-0.11
Philipp Hoenisch 3 years ago
committed by Lucas Soriano del Pino
parent
commit
245aaaf7ae
No known key found for this signature in database GPG Key ID: EE611E973A1530E7
  1. 16
      Cargo.lock
  2. 1
      cfd_protocol/Cargo.toml
  3. 3
      cfd_protocol/src/lib.rs

16
Cargo.lock

@ -154,6 +154,7 @@ dependencies = [
"anyhow", "anyhow",
"bdk", "bdk",
"bitcoin", "bitcoin",
"itertools",
"rand 0.6.5", "rand 0.6.5",
"rand_chacha 0.1.1", "rand_chacha 0.1.1",
"secp256k1-zkp", "secp256k1-zkp",
@ -206,6 +207,12 @@ dependencies = [
"lazy_static", "lazy_static",
] ]
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]] [[package]]
name = "electrum-client" name = "electrum-client"
version = "0.8.0" version = "0.8.0"
@ -269,6 +276,15 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "itertools"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.4.8" version = "0.4.8"

1
cfd_protocol/Cargo.toml

@ -6,6 +6,7 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1" anyhow = "1"
bdk = { git = "https://github.com/bitcoindevkit/bdk/", rev = "acf157a99a305226203d2b55a567291a93c64720" } bdk = { git = "https://github.com/bitcoindevkit/bdk/", rev = "acf157a99a305226203d2b55a567291a93c64720" }
itertools = "0.10"
rand = "0.6" rand = "0.6"
rand_chacha = "0.1" rand_chacha = "0.1"
secp256k1-zkp = { version = "0.4", features = ["hashes", "global-context"] } secp256k1-zkp = { version = "0.4", features = ["hashes", "global-context"] }

3
cfd_protocol/src/lib.rs

@ -13,6 +13,7 @@ use bdk::{
descriptor::Descriptor, descriptor::Descriptor,
miniscript::{descriptor::Wsh, DescriptorTrait}, miniscript::{descriptor::Wsh, DescriptorTrait},
}; };
use itertools::Itertools;
use secp256k1_zkp::EcdsaAdaptorSignature; use secp256k1_zkp::EcdsaAdaptorSignature;
use secp256k1_zkp::SecretKey; use secp256k1_zkp::SecretKey;
use secp256k1_zkp::SECP256K1; use secp256k1_zkp::SECP256K1;
@ -428,7 +429,7 @@ impl PunishTransaction {
revoked_commit_tx: &Transaction, revoked_commit_tx: &Transaction,
) -> Result<Self> { ) -> Result<Self> {
// CommitTransaction has only one input // CommitTransaction has only one input
let input = revoked_commit_tx.input[0].clone(); let input = revoked_commit_tx.input.clone().into_iter().exactly_one()?;
// Extract all signatures from witness stack // Extract all signatures from witness stack
let mut sigs = Vec::new(); let mut sigs = Vec::new();

Loading…
Cancel
Save