Rename ScriptType to KeychainKind

This avoids confusion with the "type of script".
This commit is contained in:
Alekos Filini
2020-12-14 17:14:24 +01:00
parent 7adaaf227c
commit 1713d621d4
19 changed files with 322 additions and 333 deletions

View File

@@ -28,7 +28,7 @@ use bdk::bitcoin;
use bdk::database::MemoryDatabase;
use bdk::descriptor::HDKeyPaths;
use bdk::wallet::address_validator::{AddressValidator, AddressValidatorError};
use bdk::ScriptType;
use bdk::KeychainKind;
use bdk::{OfflineWallet, Wallet};
use bitcoin::hashes::hex::FromHex;
@@ -39,7 +39,7 @@ struct DummyValidator;
impl AddressValidator for DummyValidator {
fn validate(
&self,
script_type: ScriptType,
keychain: KeychainKind,
hd_keypaths: &HDKeyPaths,
script: &Script,
) -> Result<(), AddressValidatorError> {
@@ -50,7 +50,7 @@ impl AddressValidator for DummyValidator {
println!(
"Validating `{:?}` {} address, script: {}",
script_type, path, script
keychain, path, script
);
Ok(())

View File

@@ -40,7 +40,7 @@ use miniscript::policy::Concrete;
use miniscript::Descriptor;
use bdk::database::memory::MemoryDatabase;
use bdk::{OfflineWallet, ScriptType, Wallet};
use bdk::{KeychainKind, OfflineWallet, Wallet};
fn main() {
env_logger::init_from_env(
@@ -104,7 +104,7 @@ fn main() {
info!("... First address: {}", wallet.get_new_address().unwrap());
if matches.is_present("parsed_policy") {
let spending_policy = wallet.policies(ScriptType::External).unwrap();
let spending_policy = wallet.policies(KeychainKind::External).unwrap();
info!(
"... Spending policy:\n{}",
serde_json::to_string_pretty(&spending_policy).unwrap()