Change imports_granularity to module

This reduces the overall amount of LoC that imports take up in our
codebase by almost 100.
It also makes merge-conflicts less likely because there is less
grouping together of imports that may lead to layout changes which
in turn can cause merge conflicts.
This commit is contained in:
Thomas Eizinger 2021-03-04 11:28:58 +11:00
parent 2c8200621d
commit 6d9b21cb47
No known key found for this signature in database
GPG key ID: 651AC83A6C6C8B96
55 changed files with 389 additions and 483 deletions

View file

@ -2,12 +2,14 @@ use crate::bitcoin::{
build_shared_output_descriptor, Address, Amount, BlockHeight, PublicKey, Transaction, TxLock,
TX_FEE,
};
use ::bitcoin::{util::bip143::SigHashCache, OutPoint, SigHash, SigHashType, TxIn, TxOut, Txid};
use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{OutPoint, SigHash, SigHashType, TxIn, TxOut, Txid};
use anyhow::Result;
use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, ops::Add};
use std::collections::HashMap;
use std::ops::Add;
/// Represent a timelock, expressed in relative block height as defined in
/// [BIP68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki).

View file

@ -1,7 +1,8 @@
use crate::bitcoin::{
build_shared_output_descriptor, Address, Amount, PublicKey, Transaction, Wallet, TX_FEE,
};
use ::bitcoin::{util::psbt::PartiallySignedTransaction, OutPoint, TxIn, TxOut, Txid};
use ::bitcoin::util::psbt::PartiallySignedTransaction;
use ::bitcoin::{OutPoint, TxIn, TxOut, Txid};
use anyhow::Result;
use ecdsa_fun::fun::Point;
use miniscript::{Descriptor, DescriptorTrait};

View file

@ -1,5 +1,6 @@
use crate::bitcoin::{Address, PublicKey, PunishTimelock, Transaction, TxCancel};
use ::bitcoin::{util::bip143::SigHashCache, SigHash, SigHashType};
use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{SigHash, SigHashType};
use anyhow::Result;
use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};

View file

@ -2,7 +2,8 @@ use crate::bitcoin::{
verify_sig, Address, EmptyWitnessStack, NoInputs, NotThreeWitnesses, PublicKey, TooManyInputs,
Transaction, TxLock,
};
use ::bitcoin::{util::bip143::SigHashCache, SigHash, SigHashType, Txid};
use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{SigHash, SigHashType, Txid};
use anyhow::{bail, Context, Result};
use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};

View file

@ -2,7 +2,8 @@ use crate::bitcoin::{
verify_sig, Address, EmptyWitnessStack, NoInputs, NotThreeWitnesses, PublicKey, TooManyInputs,
Transaction, TxCancel,
};
use ::bitcoin::{util::bip143::SigHashCache, SigHash, SigHashType, Txid};
use ::bitcoin::util::bip143::SigHashCache;
use ::bitcoin::{SigHash, SigHashType, Txid};
use anyhow::{bail, Context, Result};
use ecdsa_fun::Signature;
use miniscript::{Descriptor, DescriptorTrait};

View file

@ -1,22 +1,24 @@
use crate::{
bitcoin::{timelocks::BlockHeight, Address, Amount, Transaction},
execution_params::ExecutionParams,
};
use ::bitcoin::{util::psbt::PartiallySignedTransaction, Txid};
use crate::bitcoin::timelocks::BlockHeight;
use crate::bitcoin::{Address, Amount, Transaction};
use crate::execution_params::ExecutionParams;
use ::bitcoin::util::psbt::PartiallySignedTransaction;
use ::bitcoin::Txid;
use anyhow::{anyhow, bail, Context, Result};
use backoff::{backoff::Constant as ConstantBackoff, future::retry};
use bdk::{
blockchain::{noop_progress, Blockchain, ElectrumBlockchain},
descriptor::Segwitv0,
electrum_client::{self, Client, ElectrumApi},
keys::DerivableKey,
FeeRate, KeychainKind,
};
use backoff::backoff::Constant as ConstantBackoff;
use backoff::future::retry;
use bdk::blockchain::{noop_progress, Blockchain, ElectrumBlockchain};
use bdk::descriptor::Segwitv0;
use bdk::electrum_client::{self, Client, ElectrumApi};
use bdk::keys::DerivableKey;
use bdk::{FeeRate, KeychainKind};
use bitcoin::Script;
use reqwest::{Method, Url};
use serde::{Deserialize, Serialize};
use std::{path::Path, sync::Arc, time::Duration};
use tokio::{sync::Mutex, time::interval};
use std::path::Path;
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::Mutex;
use tokio::time::interval;
const SLED_TREE_NAME: &str = "default_tree";
@ -309,13 +311,9 @@ fn blocks_tip_height_url(base_url: &Url) -> Result<Url> {
#[cfg(test)]
mod tests {
use crate::{
bitcoin::{
wallet::{blocks_tip_height_url, tx_status_url},
Txid,
},
cli::config::DEFAULT_ELECTRUM_HTTP_URL,
};
use crate::bitcoin::wallet::{blocks_tip_height_url, tx_status_url};
use crate::bitcoin::Txid;
use crate::cli::config::DEFAULT_ELECTRUM_HTTP_URL;
use reqwest::Url;
#[test]