Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions types/src/model/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -682,8 +682,7 @@ pub struct ListUnspentItem {
/// The script key.
pub script_pubkey: ScriptBuf,
/// The transaction amount.
#[serde(default, with = "bitcoin::amount::serde::as_btc")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is correct but unrelated to the PR. Took me a minute to work out why it was being removed.

Take pity on us poor reviewers please, throw changes like this in a separate patch that says what it does and save me a few clock cycles. This old brain is hard to kick into gear sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean unrelated?
I've seen that all bitcoin::Amounts in other parts of the codebase do not need a #[serde(default, with = "bitcoin::amount::serde::as_btc")].

Everything squashed to a single commit in 9541cad

pub amount: SignedAmount,
pub amount: Amount,
/// The number of confirmations.
pub confirmations: u32, // Docs do not indicate what negative value means?
/// The redeemScript if scriptPubKey is P2SH.
Expand Down
2 changes: 1 addition & 1 deletion types/src/v17/wallet/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ impl ListUnspentItem {
let address = self.address.parse::<Address<_>>().map_err(E::Address)?;
let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubkey)?;

let amount = SignedAmount::from_btc(self.amount).map_err(E::Amount)?;
let amount = Amount::from_btc(self.amount).map_err(E::Amount)?;
let confirmations = crate::to_u32(self.confirmations, "confirmations")?;
let redeem_script = self
.redeem_script
Expand Down
6 changes: 2 additions & 4 deletions types/src/v18/wallet/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use bitcoin::amount::ParseAmountError;
use bitcoin::hashes::hash160;
use bitcoin::hex::FromHex;
use bitcoin::key::PublicKey;
use bitcoin::{
bip32, Address, Amount, ScriptBuf, SignedAmount, Txid, WitnessProgram, WitnessVersion,
};
use bitcoin::{bip32, Address, Amount, ScriptBuf, Txid, WitnessProgram, WitnessVersion};

use super::{
GetAddressInfo, GetAddressInfoEmbedded, GetAddressInfoEmbeddedError, GetAddressInfoError,
Expand Down Expand Up @@ -304,7 +302,7 @@ impl ListUnspentItem {
let address = self.address.parse::<Address<_>>().map_err(E::Address)?;
let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubkey)?;

let amount = SignedAmount::from_btc(self.amount).map_err(E::Amount)?;
let amount = Amount::from_btc(self.amount).map_err(E::Amount)?;
let confirmations = crate::to_u32(self.confirmations, "confirmations")?;
let redeem_script = self
.redeem_script
Expand Down
4 changes: 2 additions & 2 deletions types/src/v24/wallet/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use bitcoin::amount::ParseAmountError;
use bitcoin::consensus::encode;
use bitcoin::{Address, BlockHash, ScriptBuf, SignedAmount, Transaction, Txid};
use bitcoin::{Address, Amount, BlockHash, ScriptBuf, SignedAmount, Transaction, Txid};

use super::{
GetTransaction, GetTransactionDetail, GetTransactionDetailError, GetTransactionError,
Expand Down Expand Up @@ -218,7 +218,7 @@ impl ListUnspentItem {
let script_pubkey = ScriptBuf::from_hex(&self.script_pubkey).map_err(E::ScriptPubkey)?;
let label = self.label.unwrap_or_default();

let amount = SignedAmount::from_btc(self.amount).map_err(E::Amount)?;
let amount = Amount::from_btc(self.amount).map_err(E::Amount)?;
let confirmations = crate::to_u32(self.confirmations, "confirmations")?;
let redeem_script = self
.redeem_script
Expand Down