tests: replace Amount::from_sat_unchecked with from_sat.unwrap

There are only 7 instances of this so just call .unwrap() on each one.
This commit is contained in:
Andrew Poelstra 2025-03-18 14:47:44 +00:00
parent beaa2db7e5
commit 05c8b043ff
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
2 changed files with 7 additions and 7 deletions

View File

@ -1502,7 +1502,7 @@ mod tests {
)]), )]),
}], }],
output: vec![TxOut { output: vec![TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::from_hex( script_pubkey: ScriptBuf::from_hex(
"a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587", "a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587",
) )
@ -1553,7 +1553,7 @@ mod tests {
Input { Input {
non_witness_utxo: Some(tx), non_witness_utxo: Some(tx),
witness_utxo: Some(TxOut { witness_utxo: Some(TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(),
}), }),
sighash_type: Some("SIGHASH_SINGLE|SIGHASH_ANYONECANPAY".parse::<PsbtSighashType>().unwrap()), sighash_type: Some("SIGHASH_SINGLE|SIGHASH_ANYONECANPAY".parse::<PsbtSighashType>().unwrap()),
@ -1729,7 +1729,7 @@ mod tests {
script_pubkey: ScriptBuf::from_hex("76a91485cff1097fd9e008bb34af709c62197b38978a4888ac").unwrap(), script_pubkey: ScriptBuf::from_hex("76a91485cff1097fd9e008bb34af709c62197b38978a4888ac").unwrap(),
}, },
TxOut { TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(),
}, },
], ],
@ -2062,7 +2062,7 @@ mod tests {
script_pubkey: ScriptBuf::from_hex("76a91485cff1097fd9e008bb34af709c62197b38978a4888ac").unwrap(), script_pubkey: ScriptBuf::from_hex("76a91485cff1097fd9e008bb34af709c62197b38978a4888ac").unwrap(),
}, },
TxOut { TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(),
}, },
], ],
@ -2234,7 +2234,7 @@ mod tests {
script_pubkey: ScriptBuf::new() script_pubkey: ScriptBuf::new()
}, },
TxOut { TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::new() script_pubkey: ScriptBuf::new()
}, },
], ],

View File

@ -235,7 +235,7 @@ fn serde_regression_psbt() {
.unwrap()]), .unwrap()]),
}], }],
output: vec![TxOut { output: vec![TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587") script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587")
.unwrap(), .unwrap(),
}], }],
@ -282,7 +282,7 @@ fn serde_regression_psbt() {
inputs: vec![Input { inputs: vec![Input {
non_witness_utxo: Some(tx), non_witness_utxo: Some(tx),
witness_utxo: Some(TxOut { witness_utxo: Some(TxOut {
value: Amount::from_sat_unchecked(190_303_501_938), value: Amount::from_sat(190_303_501_938).unwrap(),
script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(), script_pubkey: ScriptBuf::from_hex("a914339725ba21efd62ac753a9bcd067d6c7a6a39d0587").unwrap(),
}), }),
sighash_type: Some(PsbtSighashType::from("SIGHASH_SINGLE|SIGHASH_ANYONECANPAY".parse::<EcdsaSighashType>().unwrap())), sighash_type: Some(PsbtSighashType::from("SIGHASH_SINGLE|SIGHASH_ANYONECANPAY".parse::<EcdsaSighashType>().unwrap())),