Merge bitcoindevkit/bdk#1177: Upgrade bitcoin/miniscript dependencies

984c758f96 Upgrade miniscript/bitcoin dependency (Tobin C. Harding)

Pull request description:

  Upgrade:

  - bitcoin to v0.31.0
  - miniscript to v11.0.0

  Fix: #1196

ACKs for top commit:
  ValuedMammal:
    ACK 984c758f96
  notmandatory:
    ACK 984c758f96
  oleonardolima:
    ACK 984c758f96
  storopoli:
    ACK 984c758f96

Tree-SHA512: d64d530e93cc36688ba07d3677d5c1689b61f246f05d08092bbf86ddbba8a5ec49648e6825b950ef17729dc064da50d50b793475a288862a0461976876807170
This commit is contained in:
Steve Myers
2024-04-12 10:48:48 -05:00
49 changed files with 556 additions and 519 deletions

View File

@@ -4,7 +4,7 @@ use crate::{
collections::{hash_map::Entry, BTreeMap, BTreeSet, HashMap},
indexed_tx_graph::Indexer,
};
use bitcoin::{self, OutPoint, Script, ScriptBuf, Transaction, TxOut, Txid};
use bitcoin::{OutPoint, Script, ScriptBuf, Transaction, TxOut, Txid};
/// An index storing [`TxOut`]s that have a script pubkey that matches those in a list.
///
@@ -281,12 +281,12 @@ impl<I: Clone + Ord> SpkTxOutIndex<I> {
for txin in &tx.input {
if let Some((_, txout)) = self.txout(txin.previous_output) {
sent += txout.value;
sent += txout.value.to_sat();
}
}
for txout in &tx.output {
if self.index_of_spk(&txout.script_pubkey).is_some() {
received += txout.value;
received += txout.value.to_sat();
}
}

View File

@@ -319,7 +319,7 @@ impl<A> TxGraph<A> {
///
/// [`insert_txout`]: Self::insert_txout
pub fn calculate_fee(&self, tx: &Transaction) -> Result<u64, CalculateFeeError> {
if tx.is_coin_base() {
if tx.is_coinbase() {
return Ok(0);
}
@@ -331,7 +331,7 @@ impl<A> TxGraph<A> {
(sum, missing_outpoints)
}
Some(txout) => {
sum += txout.value as i64;
sum += txout.value.to_sat() as i64;
(sum, missing_outpoints)
}
},
@@ -343,7 +343,7 @@ impl<A> TxGraph<A> {
let outputs_sum = tx
.output
.iter()
.map(|txout| txout.value as i64)
.map(|txout| txout.value.to_sat() as i64)
.sum::<i64>();
let fee = inputs_sum - outputs_sum;
@@ -870,7 +870,7 @@ impl<A: Anchor> TxGraph<A> {
TxNodeInternal::Whole(tx) => {
// A coinbase tx that is not anchored in the best chain cannot be unconfirmed and
// should always be filtered out.
if tx.as_ref().is_coin_base() {
if tx.is_coinbase() {
return Ok(None);
}
tx.clone()
@@ -1126,7 +1126,7 @@ impl<A: Anchor> TxGraph<A> {
txout,
chain_position,
spent_by,
is_on_coinbase: tx_node.tx.as_ref().is_coin_base(),
is_on_coinbase: tx_node.tx.is_coinbase(),
},
)))
},
@@ -1229,16 +1229,16 @@ impl<A: Anchor> TxGraph<A> {
match &txout.chain_position {
ChainPosition::Confirmed(_) => {
if txout.is_confirmed_and_spendable(chain_tip.height) {
confirmed += txout.txout.value;
confirmed += txout.txout.value.to_sat();
} else if !txout.is_mature(chain_tip.height) {
immature += txout.txout.value;
immature += txout.txout.value.to_sat();
}
}
ChainPosition::Unconfirmed(_) => {
if trust_predicate(&spk_i, &txout.txout.script_pubkey) {
trusted_pending += txout.txout.value;
trusted_pending += txout.txout.value.to_sat();
} else {
untrusted_pending += txout.txout.value;
untrusted_pending += txout.txout.value.to_sat();
}
}
}