Convert upper-case acronyms as suggested by CamelCase convention
see https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
//! fn validate(
|
||||
//! &self,
|
||||
//! keychain: KeychainKind,
|
||||
//! hd_keypaths: &HDKeyPaths,
|
||||
//! hd_keypaths: &HdKeyPaths,
|
||||
//! script: &Script
|
||||
//! ) -> Result<(), AddressValidatorError> {
|
||||
//! let address = Address::from_script(script, Network::Testnet)
|
||||
@@ -67,7 +67,7 @@ use std::fmt;
|
||||
|
||||
use bitcoin::Script;
|
||||
|
||||
use crate::descriptor::HDKeyPaths;
|
||||
use crate::descriptor::HdKeyPaths;
|
||||
use crate::types::KeychainKind;
|
||||
|
||||
/// Errors that can be returned to fail the validation of an address
|
||||
@@ -105,7 +105,7 @@ pub trait AddressValidator: Send + Sync + fmt::Debug {
|
||||
fn validate(
|
||||
&self,
|
||||
keychain: KeychainKind,
|
||||
hd_keypaths: &HDKeyPaths,
|
||||
hd_keypaths: &HdKeyPaths,
|
||||
script: &Script,
|
||||
) -> Result<(), AddressValidatorError>;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ mod test {
|
||||
fn validate(
|
||||
&self,
|
||||
_keychain: KeychainKind,
|
||||
_hd_keypaths: &HDKeyPaths,
|
||||
_hd_keypaths: &HdKeyPaths,
|
||||
_script: &bitcoin::Script,
|
||||
) -> Result<(), AddressValidatorError> {
|
||||
Err(AddressValidatorError::InvalidScript)
|
||||
|
||||
@@ -59,7 +59,7 @@ use crate::descriptor::{
|
||||
Policy, XKeyUtils,
|
||||
};
|
||||
use crate::error::Error;
|
||||
use crate::psbt::PSBTUtils;
|
||||
use crate::psbt::PsbtUtils;
|
||||
use crate::types::*;
|
||||
|
||||
const CACHE_ADDR_BATCH_SIZE: u32 = 100;
|
||||
@@ -465,13 +465,13 @@ where
|
||||
(None, Some(csv)) => csv,
|
||||
|
||||
// RBF with a specific value but that value is too high
|
||||
(Some(tx_builder::RBFValue::Value(rbf)), _) if rbf >= 0xFFFFFFFE => {
|
||||
(Some(tx_builder::RbfValue::Value(rbf)), _) if rbf >= 0xFFFFFFFE => {
|
||||
return Err(Error::Generic(
|
||||
"Cannot enable RBF with a nSequence >= 0xFFFFFFFE".into(),
|
||||
))
|
||||
}
|
||||
// RBF with a specific value requested, but the value is incompatible with CSV
|
||||
(Some(tx_builder::RBFValue::Value(rbf)), Some(csv))
|
||||
(Some(tx_builder::RbfValue::Value(rbf)), Some(csv))
|
||||
if !check_nsequence_rbf(rbf, csv) =>
|
||||
{
|
||||
return Err(Error::Generic(format!(
|
||||
@@ -481,7 +481,7 @@ where
|
||||
}
|
||||
|
||||
// RBF enabled with the default value with CSV also enabled. CSV takes precedence
|
||||
(Some(tx_builder::RBFValue::Default), Some(csv)) => csv,
|
||||
(Some(tx_builder::RbfValue::Default), Some(csv)) => csv,
|
||||
// Valid RBF, either default or with a specific value. We ignore the `CSV` value
|
||||
// because we've already checked it before
|
||||
(Some(rbf), _) => rbf.get_value(),
|
||||
@@ -750,7 +750,7 @@ where
|
||||
.database
|
||||
.borrow()
|
||||
.get_previous_output(&txin.previous_output)?
|
||||
.ok_or(Error::UnknownUTXO)?;
|
||||
.ok_or(Error::UnknownUtxo)?;
|
||||
|
||||
let (weight, keychain) = match self
|
||||
.database
|
||||
@@ -1260,7 +1260,7 @@ where
|
||||
) {
|
||||
Ok(psbt_input) => psbt_input,
|
||||
Err(e) => match e {
|
||||
Error::UnknownUTXO => Input {
|
||||
Error::UnknownUtxo => Input {
|
||||
sighash_type: params.sighash,
|
||||
..Input::default()
|
||||
},
|
||||
@@ -1326,7 +1326,7 @@ where
|
||||
.database
|
||||
.borrow()
|
||||
.get_path_from_script_pubkey(&utxo.txout.script_pubkey)?
|
||||
.ok_or(Error::UnknownUTXO)?;
|
||||
.ok_or(Error::UnknownUtxo)?;
|
||||
|
||||
let mut psbt_input = Input {
|
||||
sighash_type,
|
||||
@@ -2047,7 +2047,7 @@ mod test {
|
||||
builder
|
||||
.add_recipient(addr.script_pubkey(), 30_000)
|
||||
.add_recipient(addr.script_pubkey(), 10_000)
|
||||
.ordering(super::tx_builder::TxOrdering::BIP69Lexicographic);
|
||||
.ordering(super::tx_builder::TxOrdering::Bip69Lexicographic);
|
||||
let (psbt, details) = builder.finish().unwrap();
|
||||
|
||||
assert_eq!(psbt.global.unsigned_tx.output.len(), 3);
|
||||
|
||||
@@ -146,7 +146,7 @@ pub enum SignerError {
|
||||
/// The `witness_script` field of the transaction is requied to sign this input
|
||||
MissingWitnessScript,
|
||||
/// The fingerprint and derivation path are missing from the psbt input
|
||||
MissingHDKeypath,
|
||||
MissingHdKeypath,
|
||||
}
|
||||
|
||||
impl fmt::Display for SignerError {
|
||||
|
||||
@@ -143,7 +143,7 @@ pub(crate) struct TxParams {
|
||||
pub(crate) sighash: Option<SigHashType>,
|
||||
pub(crate) ordering: TxOrdering,
|
||||
pub(crate) locktime: Option<u32>,
|
||||
pub(crate) rbf: Option<RBFValue>,
|
||||
pub(crate) rbf: Option<RbfValue>,
|
||||
pub(crate) version: Option<Version>,
|
||||
pub(crate) change_policy: ChangeSpendPolicy,
|
||||
pub(crate) force_non_witness_utxo: bool,
|
||||
@@ -278,7 +278,7 @@ impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>, Ctx: TxBuilderConte
|
||||
pub fn add_utxos(&mut self, outpoints: &[OutPoint]) -> Result<&mut Self, Error> {
|
||||
let utxos = outpoints
|
||||
.iter()
|
||||
.map(|outpoint| self.wallet.get_utxo(*outpoint)?.ok_or(Error::UnknownUTXO))
|
||||
.map(|outpoint| self.wallet.get_utxo(*outpoint)?.ok_or(Error::UnknownUtxo))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
for utxo in utxos {
|
||||
@@ -563,7 +563,7 @@ impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>> TxBuilder<'a, B, D,
|
||||
///
|
||||
/// This will use the default nSequence value of `0xFFFFFFFD`.
|
||||
pub fn enable_rbf(&mut self) -> &mut Self {
|
||||
self.params.rbf = Some(RBFValue::Default);
|
||||
self.params.rbf = Some(RbfValue::Default);
|
||||
self
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ impl<'a, B, D: BatchDatabase, Cs: CoinSelectionAlgorithm<D>> TxBuilder<'a, B, D,
|
||||
/// If the `nsequence` is higher than `0xFFFFFFFD` an error will be thrown, since it would not
|
||||
/// be a valid nSequence to signal RBF.
|
||||
pub fn enable_rbf_with_sequence(&mut self, nsequence: u32) -> &mut Self {
|
||||
self.params.rbf = Some(RBFValue::Value(nsequence));
|
||||
self.params.rbf = Some(RbfValue::Value(nsequence));
|
||||
self
|
||||
}
|
||||
}
|
||||
@@ -612,7 +612,7 @@ pub enum TxOrdering {
|
||||
/// Unchanged
|
||||
Untouched,
|
||||
/// BIP69 / Lexicographic
|
||||
BIP69Lexicographic,
|
||||
Bip69Lexicographic,
|
||||
}
|
||||
|
||||
impl Default for TxOrdering {
|
||||
@@ -638,7 +638,7 @@ impl TxOrdering {
|
||||
|
||||
tx.output.shuffle(&mut rng);
|
||||
}
|
||||
TxOrdering::BIP69Lexicographic => {
|
||||
TxOrdering::Bip69Lexicographic => {
|
||||
tx.input.sort_unstable_by_key(|txin| {
|
||||
(txin.previous_output.txid, txin.previous_output.vout)
|
||||
});
|
||||
@@ -665,16 +665,16 @@ impl Default for Version {
|
||||
///
|
||||
/// Has a default value of `0xFFFFFFFD`
|
||||
#[derive(Debug, Ord, PartialOrd, Eq, PartialEq, Hash, Clone, Copy)]
|
||||
pub(crate) enum RBFValue {
|
||||
pub(crate) enum RbfValue {
|
||||
Default,
|
||||
Value(u32),
|
||||
}
|
||||
|
||||
impl RBFValue {
|
||||
impl RbfValue {
|
||||
pub(crate) fn get_value(&self) -> u32 {
|
||||
match self {
|
||||
RBFValue::Default => 0xFFFFFFFD,
|
||||
RBFValue::Value(v) => *v,
|
||||
RbfValue::Default => 0xFFFFFFFD,
|
||||
RbfValue::Value(v) => *v,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -759,7 +759,7 @@ mod test {
|
||||
let original_tx = ordering_test_tx!();
|
||||
let mut tx = original_tx;
|
||||
|
||||
TxOrdering::BIP69Lexicographic.sort_tx(&mut tx);
|
||||
TxOrdering::Bip69Lexicographic.sort_tx(&mut tx);
|
||||
|
||||
assert_eq!(
|
||||
tx.input[0].previous_output,
|
||||
|
||||
Reference in New Issue
Block a user