3.10 Remove use of Network::Bitcoin

All uses were safe due to addresses being converted to script_pubkeys which
don't embed their network. The only risk of there being an issue is if a
future address spec did embed the net ID into the script_pubkey and that was
moved to.

This resolves the audit note and does offer that tightening.
This commit is contained in:
Luke Parker
2023-07-20 00:00:20 -04:00
parent 6f9d02fdf8
commit f66fe3c1cb
4 changed files with 28 additions and 22 deletions

View File

@@ -16,12 +16,12 @@ use bitcoin::{
sighash::{TapSighashType, SighashCache, Prevouts},
absolute::LockTime,
script::{PushBytesBuf, ScriptBuf},
OutPoint, Sequence, Witness, TxIn, TxOut, Transaction, Network, Address,
OutPoint, Sequence, Witness, TxIn, TxOut, Transaction, Address,
};
use crate::{
crypto::Schnorr,
wallet::{address, ReceivedOutput},
wallet::{ReceivedOutput, address_payload},
};
#[rustfmt::skip]
@@ -226,9 +226,7 @@ impl SignableTransaction {
transcript.append_message(b"signing_input", u32::try_from(i).unwrap().to_le_bytes());
let offset = keys.clone().offset(self.offsets[i]);
if address(Network::Bitcoin, offset.group_key())?.script_pubkey() !=
self.prevouts[i].script_pubkey
{
if address_payload(offset.group_key())?.script_pubkey() != self.prevouts[i].script_pubkey {
None?;
}