Skip to content

Commit 4db95ee

Browse files
committed
Replace FromHex with FromStr where applicable
1 parent 8127665 commit 4db95ee

File tree

8 files changed

+52
-47
lines changed

8 files changed

+52
-47
lines changed

lightning-invoice/src/de.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,8 @@ mod test {
726726
use crate::de::Bolt11ParseError;
727727
use secp256k1::PublicKey;
728728
use bech32::u5;
729-
use bitcoin_hashes::hex::FromHex;
730729
use bitcoin_hashes::sha256;
730+
use std::str::FromStr;
731731

732732
const CHARSET_REV: [i8; 128] = [
733733
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -778,7 +778,7 @@ mod test {
778778
"qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypq".as_bytes()
779779
);
780780

781-
let hash = sha256::Hash::from_hex(
781+
let hash = sha256::Hash::from_str(
782782
"0001020304050607080900010203040506070809000102030405060708090102"
783783
).unwrap();
784784
let expected = Ok(Sha256(hash));
@@ -988,7 +988,7 @@ mod test {
988988
data: RawDataPart {
989989
timestamp: PositiveTimestamp::from_unix_timestamp(1496314658).unwrap(),
990990
tagged_fields: vec ! [
991-
PaymentHash(Sha256(sha256::Hash::from_hex(
991+
PaymentHash(Sha256(sha256::Hash::from_str(
992992
"0001020304050607080900010203040506070809000102030405060708090102"
993993
).unwrap())).into(),
994994
Description(crate::Description::new("coffee beans".to_owned()).unwrap()).into(),
@@ -1035,7 +1035,7 @@ mod test {
10351035
data: RawDataPart {
10361036
timestamp: PositiveTimestamp::from_unix_timestamp(1496314658).unwrap(),
10371037
tagged_fields: vec ! [
1038-
PaymentHash(Sha256(sha256::Hash::from_hex(
1038+
PaymentHash(Sha256(sha256::Hash::from_str(
10391039
"0001020304050607080900010203040506070809000102030405060708090102"
10401040
).unwrap())).into(),
10411041
Description(

lightning-invoice/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,8 +1760,8 @@ impl<'de> Deserialize<'de> for Bolt11Invoice {
17601760
#[cfg(test)]
17611761
mod test {
17621762
use bitcoin::ScriptBuf;
1763-
use bitcoin_hashes::hex::FromHex;
17641763
use bitcoin_hashes::sha256;
1764+
use std::str::FromStr;
17651765

17661766
#[test]
17671767
fn test_system_time_bounds_assumptions() {
@@ -1785,7 +1785,7 @@ mod test {
17851785
data: RawDataPart {
17861786
timestamp: PositiveTimestamp::from_unix_timestamp(1496314658).unwrap(),
17871787
tagged_fields: vec![
1788-
PaymentHash(crate::Sha256(sha256::Hash::from_hex(
1788+
PaymentHash(crate::Sha256(sha256::Hash::from_str(
17891789
"0001020304050607080900010203040506070809000102030405060708090102"
17901790
).unwrap())).into(),
17911791
Description(crate::Description::new(
@@ -1823,7 +1823,7 @@ mod test {
18231823
data: RawDataPart {
18241824
timestamp: PositiveTimestamp::from_unix_timestamp(1496314658).unwrap(),
18251825
tagged_fields: vec ! [
1826-
PaymentHash(Sha256(sha256::Hash::from_hex(
1826+
PaymentHash(Sha256(sha256::Hash::from_str(
18271827
"0001020304050607080900010203040506070809000102030405060708090102"
18281828
).unwrap())).into(),
18291829
Description(
@@ -1893,7 +1893,7 @@ mod test {
18931893
data: RawDataPart {
18941894
timestamp: PositiveTimestamp::from_unix_timestamp(1496314658).unwrap(),
18951895
tagged_fields: vec ! [
1896-
PaymentHash(Sha256(sha256::Hash::from_hex(
1896+
PaymentHash(Sha256(sha256::Hash::from_str(
18971897
"0001020304050607080900010203040506070809000102030405060708090102"
18981898
).unwrap())).into(),
18991899
Description(

lightning-invoice/tests/ser_de.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
2626
InvoiceBuilder::new(Currency::Bitcoin)
2727
.duration_since_epoch(Duration::from_secs(1496314658))
2828
.payment_secret(PaymentSecret([0x11; 32]))
29-
.payment_hash(sha256::Hash::from_hex(
29+
.payment_hash(sha256::Hash::from_str(
3030
"0001020304050607080900010203040506070809000102030405060708090102"
3131
).unwrap())
3232
.description("Please consider supporting this project".to_owned())
@@ -47,7 +47,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
4747
.amount_milli_satoshis(250_000_000)
4848
.duration_since_epoch(Duration::from_secs(1496314658))
4949
.payment_secret(PaymentSecret([0x11; 32]))
50-
.payment_hash(sha256::Hash::from_hex(
50+
.payment_hash(sha256::Hash::from_str(
5151
"0001020304050607080900010203040506070809000102030405060708090102"
5252
).unwrap())
5353
.description("1 cup coffee".to_owned())
@@ -69,7 +69,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
6969
.amount_milli_satoshis(250_000_000)
7070
.duration_since_epoch(Duration::from_secs(1496314658))
7171
.payment_secret(PaymentSecret([0x11; 32]))
72-
.payment_hash(sha256::Hash::from_hex(
72+
.payment_hash(sha256::Hash::from_str(
7373
"0001020304050607080900010203040506070809000102030405060708090102"
7474
).unwrap())
7575
.description("ナンセンス 1杯".to_owned())
@@ -92,7 +92,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
9292
.duration_since_epoch(Duration::from_secs(1496314658))
9393
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
9494
.payment_secret(PaymentSecret([0x11; 32]))
95-
.payment_hash(sha256::Hash::from_hex(
95+
.payment_hash(sha256::Hash::from_str(
9696
"0001020304050607080900010203040506070809000102030405060708090102"
9797
).unwrap())
9898
.build_raw()
@@ -113,7 +113,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
113113
.duration_since_epoch(Duration::from_secs(1496314658))
114114
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
115115
.payment_secret(PaymentSecret([0x11; 32]))
116-
.payment_hash(sha256::Hash::from_hex(
116+
.payment_hash(sha256::Hash::from_str(
117117
"0001020304050607080900010203040506070809000102030405060708090102"
118118
).unwrap())
119119
.fallback(Fallback::PubKeyHash(PubkeyHash::from_slice(&[49, 114, 181, 101, 79, 102, 131, 200, 251, 20, 105, 89, 211, 71, 206, 48, 60, 174, 76, 167]).unwrap()))
@@ -135,7 +135,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
135135
.duration_since_epoch(Duration::from_secs(1496314658))
136136
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
137137
.payment_secret(PaymentSecret([0x11; 32]))
138-
.payment_hash(sha256::Hash::from_hex(
138+
.payment_hash(sha256::Hash::from_str(
139139
"0001020304050607080900010203040506070809000102030405060708090102"
140140
).unwrap())
141141
.fallback(Fallback::PubKeyHash(PubkeyHash::from_slice(&[4, 182, 31, 125, 193, 234, 13, 201, 148, 36, 70, 76, 196, 6, 77, 197, 100, 217, 30, 137]).unwrap()))
@@ -174,7 +174,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
174174
.duration_since_epoch(Duration::from_secs(1496314658))
175175
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
176176
.payment_secret(PaymentSecret([0x11; 32]))
177-
.payment_hash(sha256::Hash::from_hex(
177+
.payment_hash(sha256::Hash::from_str(
178178
"0001020304050607080900010203040506070809000102030405060708090102"
179179
).unwrap())
180180
.fallback(Fallback::ScriptHash(ScriptHash::from_slice(&[143, 85, 86, 59, 154, 25, 243, 33, 194, 17, 233, 185, 243, 140, 223, 104, 110, 160, 120, 69]).unwrap()))
@@ -196,7 +196,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
196196
.duration_since_epoch(Duration::from_secs(1496314658))
197197
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
198198
.payment_secret(PaymentSecret([0x11; 32]))
199-
.payment_hash(sha256::Hash::from_hex(
199+
.payment_hash(sha256::Hash::from_str(
200200
"0001020304050607080900010203040506070809000102030405060708090102"
201201
).unwrap())
202202
.fallback(Fallback::SegWitProgram { version: WitnessVersion::V0,
@@ -220,7 +220,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
220220
.duration_since_epoch(Duration::from_secs(1496314658))
221221
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
222222
.payment_secret(PaymentSecret([0x11; 32]))
223-
.payment_hash(sha256::Hash::from_hex(
223+
.payment_hash(sha256::Hash::from_str(
224224
"0001020304050607080900010203040506070809000102030405060708090102"
225225
).unwrap())
226226
.fallback(Fallback::SegWitProgram { version: WitnessVersion::V0,
@@ -243,7 +243,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
243243
.amount_milli_satoshis(967878534)
244244
.duration_since_epoch(Duration::from_secs(1572468703))
245245
.payment_secret(PaymentSecret([0x11; 32]))
246-
.payment_hash(sha256::Hash::from_hex(
246+
.payment_hash(sha256::Hash::from_str(
247247
"462264ede7e14047e9b249da94fefc47f41f7d02ee9b091815a5506bc8abf75f"
248248
).unwrap())
249249
.expiry_time(Duration::from_secs(604800))
@@ -275,7 +275,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
275275
.amount_milli_satoshis(2_500_000_000)
276276
.duration_since_epoch(Duration::from_secs(1496314658))
277277
.payment_secret(PaymentSecret([0x11; 32]))
278-
.payment_hash(sha256::Hash::from_hex(
278+
.payment_hash(sha256::Hash::from_str(
279279
"0001020304050607080900010203040506070809000102030405060708090102"
280280
).unwrap())
281281
.description("coffee beans".to_owned())
@@ -296,7 +296,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
296296
.amount_milli_satoshis(2_500_000_000)
297297
.duration_since_epoch(Duration::from_secs(1496314658))
298298
.payment_secret(PaymentSecret([0x11; 32]))
299-
.payment_hash(sha256::Hash::from_hex(
299+
.payment_hash(sha256::Hash::from_str(
300300
"0001020304050607080900010203040506070809000102030405060708090102"
301301
).unwrap())
302302
.description("coffee beans".to_owned())
@@ -317,7 +317,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
317317
.amount_milli_satoshis(2_500_000_000)
318318
.duration_since_epoch(Duration::from_secs(1496314658))
319319
.payment_secret(PaymentSecret([0x11; 32]))
320-
.payment_hash(sha256::Hash::from_hex(
320+
.payment_hash(sha256::Hash::from_str(
321321
"0001020304050607080900010203040506070809000102030405060708090102"
322322
).unwrap())
323323
.description("coffee beans".to_owned())
@@ -337,7 +337,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
337337
InvoiceBuilder::new(Currency::Bitcoin)
338338
.amount_milli_satoshis(1_000_000_000)
339339
.duration_since_epoch(Duration::from_secs(1496314658))
340-
.payment_hash(sha256::Hash::from_hex(
340+
.payment_hash(sha256::Hash::from_str(
341341
"0001020304050607080900010203040506070809000102030405060708090102"
342342
).unwrap())
343343
.description("payment metadata inside".to_owned())
@@ -363,7 +363,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
363363
InvoiceBuilder::new(Currency::Bitcoin)
364364
.amount_milli_satoshis(1_000_000_000)
365365
.duration_since_epoch(Duration::from_secs(1496314658))
366-
.payment_hash(sha256::Hash::from_hex(
366+
.payment_hash(sha256::Hash::from_str(
367367
"0001020304050607080900010203040506070809000102030405060708090102"
368368
).unwrap())
369369
.description("payment metadata inside".to_owned())

lightning-persister/src/fs_store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ mod tests {
369369
use super::*;
370370
use crate::test_utils::{do_read_write_remove_list_persist, do_test_store};
371371

372-
use bitcoin::hashes::hex::FromHex;
373372
use bitcoin::Txid;
374373

375374
use lightning::chain::ChannelMonitorUpdateStatus;
@@ -381,6 +380,7 @@ mod tests {
381380
use lightning::util::test_utils;
382381
use lightning::util::persist::read_channel_monitors;
383382
use std::fs;
383+
use std::str::FromStr;
384384
#[cfg(target_os = "windows")]
385385
use {
386386
lightning::get_event_msg,
@@ -466,7 +466,7 @@ mod tests {
466466
fs::set_permissions(path, perms).unwrap();
467467

468468
let test_txo = OutPoint {
469-
txid: Txid::from_hex("8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be").unwrap(),
469+
txid: Txid::from_str("8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be").unwrap(),
470470
index: 0
471471
};
472472
match store.persist_new_channel(test_txo, &added_monitors[0].1, update_id.2) {

lightning/src/chain/channelmonitor.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4521,6 +4521,8 @@ mod tests {
45214521
use crate::ln::features::ChannelTypeFeatures;
45224522
use crate::prelude::*;
45234523

4524+
use std::str::FromStr;
4525+
45244526
fn do_test_funding_spend_refuses_updates(use_local_txn: bool) {
45254527
// Previously, monitor updates were allowed freely even after a funding-spend transaction
45264528
// confirmed. This would allow a race condition where we could receive a payment (including
@@ -4802,7 +4804,7 @@ mod tests {
48024804
}
48034805

48044806
let script_pubkey = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script();
4805-
let txid = Txid::from_hex("56944c5d3f98413ef45cf54545538103cc9f298e0575820ad3591376e2e0f65d").unwrap();
4807+
let txid = Txid::from_str("56944c5d3f98413ef45cf54545538103cc9f298e0575820ad3591376e2e0f65d").unwrap();
48064808

48074809
// Justice tx with 1 to_holder, 2 revoked offered HTLCs, 1 revoked received HTLCs
48084810
for channel_type_features in [ChannelTypeFeatures::only_static_remote_key(), ChannelTypeFeatures::anchors_zero_htlc_fee_and_dependencies()].iter() {

lightning/src/chain/package.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,8 @@ mod tests {
12021202
use bitcoin::secp256k1::Secp256k1;
12031203
use crate::ln::features::ChannelTypeFeatures;
12041204

1205+
use std::str::FromStr;
1206+
12051207
macro_rules! dumb_revk_output {
12061208
($secp_ctx: expr, $is_counterparty_balance_on_anchors: expr) => {
12071209
{
@@ -1249,7 +1251,7 @@ mod tests {
12491251
#[test]
12501252
#[should_panic]
12511253
fn test_package_differing_heights() {
1252-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1254+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
12531255
let secp_ctx = Secp256k1::new();
12541256
let revk_outp = dumb_revk_output!(secp_ctx, false);
12551257

@@ -1261,7 +1263,7 @@ mod tests {
12611263
#[test]
12621264
#[should_panic]
12631265
fn test_package_untractable_merge_to() {
1264-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1266+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
12651267
let secp_ctx = Secp256k1::new();
12661268
let revk_outp = dumb_revk_output!(secp_ctx, false);
12671269
let htlc_outp = dumb_htlc_output!();
@@ -1274,7 +1276,7 @@ mod tests {
12741276
#[test]
12751277
#[should_panic]
12761278
fn test_package_untractable_merge_from() {
1277-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1279+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
12781280
let secp_ctx = Secp256k1::new();
12791281
let htlc_outp = dumb_htlc_output!();
12801282
let revk_outp = dumb_revk_output!(secp_ctx, false);
@@ -1287,7 +1289,7 @@ mod tests {
12871289
#[test]
12881290
#[should_panic]
12891291
fn test_package_noaggregation_to() {
1290-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1292+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
12911293
let secp_ctx = Secp256k1::new();
12921294
let revk_outp = dumb_revk_output!(secp_ctx, false);
12931295
let revk_outp_counterparty_balance = dumb_revk_output!(secp_ctx, true);
@@ -1300,7 +1302,7 @@ mod tests {
13001302
#[test]
13011303
#[should_panic]
13021304
fn test_package_noaggregation_from() {
1303-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1305+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13041306
let secp_ctx = Secp256k1::new();
13051307
let revk_outp = dumb_revk_output!(secp_ctx, false);
13061308
let revk_outp_counterparty_balance = dumb_revk_output!(secp_ctx, true);
@@ -1313,7 +1315,7 @@ mod tests {
13131315
#[test]
13141316
#[should_panic]
13151317
fn test_package_empty() {
1316-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1318+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13171319
let secp_ctx = Secp256k1::new();
13181320
let revk_outp = dumb_revk_output!(secp_ctx, false);
13191321

@@ -1326,7 +1328,7 @@ mod tests {
13261328
#[test]
13271329
#[should_panic]
13281330
fn test_package_differing_categories() {
1329-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1331+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13301332
let secp_ctx = Secp256k1::new();
13311333
let revk_outp = dumb_revk_output!(secp_ctx, false);
13321334
let counterparty_outp = dumb_counterparty_output!(secp_ctx, 0, ChannelTypeFeatures::only_static_remote_key());
@@ -1338,7 +1340,7 @@ mod tests {
13381340

13391341
#[test]
13401342
fn test_package_split_malleable() {
1341-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1343+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13421344
let secp_ctx = Secp256k1::new();
13431345
let revk_outp_one = dumb_revk_output!(secp_ctx, false);
13441346
let revk_outp_two = dumb_revk_output!(secp_ctx, false);
@@ -1366,7 +1368,7 @@ mod tests {
13661368

13671369
#[test]
13681370
fn test_package_split_untractable() {
1369-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1371+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13701372
let htlc_outp_one = dumb_htlc_output!();
13711373

13721374
let mut package_one = PackageTemplate::build_package(txid, 0, htlc_outp_one, 1000, 100);
@@ -1376,7 +1378,7 @@ mod tests {
13761378

13771379
#[test]
13781380
fn test_package_timer() {
1379-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1381+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13801382
let secp_ctx = Secp256k1::new();
13811383
let revk_outp = dumb_revk_output!(secp_ctx, false);
13821384

@@ -1388,7 +1390,7 @@ mod tests {
13881390

13891391
#[test]
13901392
fn test_package_amounts() {
1391-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1393+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
13921394
let secp_ctx = Secp256k1::new();
13931395
let counterparty_outp = dumb_counterparty_output!(secp_ctx, 1_000_000, ChannelTypeFeatures::only_static_remote_key());
13941396

@@ -1398,7 +1400,7 @@ mod tests {
13981400

13991401
#[test]
14001402
fn test_package_weight() {
1401-
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
1403+
let txid = Txid::from_str("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
14021404
let secp_ctx = Secp256k1::new();
14031405

14041406
// (nVersion (4) + nLocktime (4) + count_tx_in (1) + prevout (36) + sequence (4) + script_length (1) + count_tx_out (1) + value (8) + var_int (1)) * WITNESS_SCALE_FACTOR + witness marker (2)

0 commit comments

Comments
 (0)