daemon: apply clippy 1.66.0 fixes
This commit is contained in:
parent
3ac9f39aa1
commit
d3b89add9a
@ -234,6 +234,7 @@ impl DaemonControl {
|
|||||||
/// Get a list of all known coins.
|
/// Get a list of all known coins.
|
||||||
pub fn list_coins(&self) -> ListCoinsResult {
|
pub fn list_coins(&self) -> ListCoinsResult {
|
||||||
let mut db_conn = self.db.connection();
|
let mut db_conn = self.db.connection();
|
||||||
|
#[allow(clippy::iter_kv_map)] // Because Rust 1.48
|
||||||
let coins: Vec<ListCoinsEntry> = db_conn
|
let coins: Vec<ListCoinsEntry> = db_conn
|
||||||
.coins(CoinType::All)
|
.coins(CoinType::All)
|
||||||
// Can't use into_values as of Rust 1.48
|
// Can't use into_values as of Rust 1.48
|
||||||
@ -381,10 +382,7 @@ impl DaemonControl {
|
|||||||
.ok_or(CommandError::InsufficientFunds(
|
.ok_or(CommandError::InsufficientFunds(
|
||||||
in_value, out_value, feerate_vb,
|
in_value, out_value, feerate_vb,
|
||||||
))?;
|
))?;
|
||||||
let nochange_feerate_vb = absolute_fee
|
let nochange_feerate_vb = absolute_fee.to_sat().checked_div(nochange_vb).unwrap();
|
||||||
.to_sat()
|
|
||||||
.checked_div(nochange_vb as u64)
|
|
||||||
.unwrap();
|
|
||||||
if nochange_feerate_vb.checked_mul(10).unwrap() < feerate_vb.checked_mul(9).unwrap() {
|
if nochange_feerate_vb.checked_mul(10).unwrap() < feerate_vb.checked_mul(9).unwrap() {
|
||||||
return Err(CommandError::InsufficientFunds(
|
return Err(CommandError::InsufficientFunds(
|
||||||
in_value, out_value, feerate_vb,
|
in_value, out_value, feerate_vb,
|
||||||
|
|||||||
@ -33,7 +33,7 @@ where
|
|||||||
T: consensus::Decodable,
|
T: consensus::Decodable,
|
||||||
{
|
{
|
||||||
let s = String::deserialize(d)?;
|
let s = String::deserialize(d)?;
|
||||||
let s = base64::decode(&s).map_err(de::Error::custom)?;
|
let s = base64::decode(s).map_err(de::Error::custom)?;
|
||||||
consensus::deserialize(&s).map_err(de::Error::custom)
|
consensus::deserialize(&s).map_err(de::Error::custom)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -188,7 +188,7 @@ impl Config {
|
|||||||
let config_file =
|
let config_file =
|
||||||
custom_path.unwrap_or(config_file_path().ok_or(ConfigError::DatadirNotFound)?);
|
custom_path.unwrap_or(config_file_path().ok_or(ConfigError::DatadirNotFound)?);
|
||||||
|
|
||||||
let config = toml::from_slice::<Config>(&std::fs::read(&config_file)?)
|
let config = toml::from_slice::<Config>(&std::fs::read(config_file)?)
|
||||||
.map_err(|e| ConfigError::ReadingFile(format!("Parsing configuration file: {}", e)))?;
|
.map_err(|e| ConfigError::ReadingFile(format!("Parsing configuration file: {}", e)))?;
|
||||||
config.check()?;
|
config.check()?;
|
||||||
|
|
||||||
|
|||||||
@ -647,7 +647,7 @@ mod tests {
|
|||||||
db.sanity_check(bitcoin::Network::Bitcoin, &options.main_descriptor)
|
db.sanity_check(bitcoin::Network::Bitcoin, &options.main_descriptor)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -675,7 +675,7 @@ mod tests {
|
|||||||
assert_eq!(db_tip.block_hash.unwrap(), new_tip.hash);
|
assert_eq!(db_tip.block_hash.unwrap(), new_tip.hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -819,7 +819,7 @@ mod tests {
|
|||||||
assert_eq!(coin.spend_block.unwrap().height, height);
|
assert_eq!(coin.spend_block.unwrap().height, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -916,7 +916,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1104,7 +1104,7 @@ mod tests {
|
|||||||
assert_eq!(db_coins[&coins[4].outpoint], coin);
|
assert_eq!(db_coins[&coins[4].outpoint], coin);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1142,7 +1142,7 @@ mod tests {
|
|||||||
assert_eq!(db_wallet.timestamp, dummy_timestamp);
|
assert_eq!(db_wallet.timestamp, dummy_timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1295,6 +1295,6 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::remove_dir_all(&tmp_dir).unwrap();
|
fs::remove_dir_all(tmp_dir).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,11 +105,9 @@ fn list_confirmed(control: &DaemonControl, params: Params) -> Result<serde_json:
|
|||||||
.and_then(|i| i.try_into().ok())
|
.and_then(|i| i.try_into().ok())
|
||||||
.ok_or_else(|| Error::invalid_params("Invalid 'limit' parameter."))?;
|
.ok_or_else(|| Error::invalid_params("Invalid 'limit' parameter."))?;
|
||||||
|
|
||||||
Ok(serde_json::json!(&control.list_confirmed_transactions(
|
Ok(serde_json::json!(
|
||||||
start as u32,
|
&control.list_confirmed_transactions(start, end, limit)
|
||||||
end as u32,
|
))
|
||||||
limit
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list_transactions(control: &DaemonControl, params: Params) -> Result<serde_json::Value, Error> {
|
fn list_transactions(control: &DaemonControl, params: Params) -> Result<serde_json::Value, Error> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user