Skip to content

Commit 2c2c974

Browse files
committed
Update rust-bitcoin wrappers to latest rust-bitcoin/secp
1 parent 92558d4 commit 2c2c974

File tree

4 files changed

+117
-59
lines changed

4 files changed

+117
-59
lines changed

c-bindings-gen/src/types.rs

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ fn initial_clonable_types() -> HashSet<String> {
863863
res.insert("crate::c_types::Transaction".to_owned());
864864
res.insert("crate::c_types::Witness".to_owned());
865865
res.insert("crate::c_types::WitnessVersion".to_owned());
866+
res.insert("crate::c_types::WitnessProgram".to_owned());
866867
res.insert("crate::c_types::TxIn".to_owned());
867868
res.insert("crate::c_types::TxOut".to_owned());
868869
res.insert("crate::c_types::ECDSASignature".to_owned());
@@ -1070,19 +1071,20 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
10701071
"bitcoin::secp256k1::Scalar" if !is_ref => Some("crate::c_types::BigEndianScalar"),
10711072
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"),
10721073

1073-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if is_ref => Some("crate::c_types::u8slice"),
1074-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if !is_ref => Some("crate::c_types::derived::CVec_u8Z"),
1074+
"bitcoin::blockdata::script::Script"|"bitcoin::Script" => Some("crate::c_types::u8slice"),
1075+
"bitcoin::blockdata::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some("crate::c_types::derived::CVec_u8Z"),
10751076
"bitcoin::OutPoint"|"bitcoin::blockdata::transaction::OutPoint" => Some("crate::lightning::chain::transaction::OutPoint"),
10761077
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some("crate::c_types::Transaction"),
10771078
"bitcoin::Witness" => Some("crate::c_types::Witness"),
10781079
"bitcoin::TxIn"|"bitcoin::blockdata::transaction::TxIn" if !is_ref => Some("crate::c_types::TxIn"),
10791080
"bitcoin::TxOut"|"bitcoin::blockdata::transaction::TxOut" => Some("crate::c_types::TxOut"),
10801081
"bitcoin::network::constants::Network" => Some("crate::bitcoin::network::Network"),
1081-
"bitcoin::util::address::WitnessVersion" => Some("crate::c_types::WitnessVersion"),
1082-
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some("*const [u8; 80]"),
1082+
"bitcoin::address::WitnessVersion" => Some("crate::c_types::WitnessVersion"),
1083+
"bitcoin::address::WitnessProgram" => Some("crate::c_types::WitnessProgram"),
1084+
"bitcoin::blockdata::block::Header" if is_ref => Some("*const [u8; 80]"),
10831085
"bitcoin::blockdata::block::Block" if is_ref => Some("crate::c_types::u8slice"),
10841086

1085-
"bitcoin::PackedLockTime"|"bitcoin::blockdata::locktime::PackedLockTime" => Some("u32"),
1087+
"bitcoin::blockdata::locktime::absolute::LockTime" => Some("u32"),
10861088

10871089
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some("crate::c_types::derived::CVec_u8Z"),
10881090

@@ -1098,11 +1100,12 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
10981100
if is_ref => Some("*const [u8; 32]"),
10991101

11001102
// Newtypes that we just expose in their original form.
1101-
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1103+
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin::hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
11021104
if is_ref => Some("*const [u8; 32]"),
1103-
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1105+
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin::hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
11041106
if !is_ref => Some("crate::c_types::ThirtyTwoBytes"),
11051107
"bitcoin::secp256k1::Message" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"),
1108+
"bitcoin::secp256k1::Message" if is_ref => Some("*const [u8; 32]"),
11061109
"lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret"
11071110
|"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId"
11081111
|"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId"
@@ -1178,8 +1181,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
11781181
"bitcoin::secp256k1::Scalar" if !is_ref => Some(""),
11791182
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("::bitcoin::secp256k1::ecdh::SharedSecret::from_bytes("),
11801183

1181-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if is_ref => Some("&::bitcoin::blockdata::script::Script::from(Vec::from("),
1182-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if !is_ref => Some("::bitcoin::blockdata::script::Script::from("),
1184+
"bitcoin::blockdata::script::Script"|"bitcoin::Script" => Some("::bitcoin::blockdata::script::Script::from_bytes("),
1185+
"bitcoin::blockdata::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some("::bitcoin::blockdata::script::ScriptBuf::from("),
11831186
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" if is_ref => Some("&"),
11841187
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some(""),
11851188
"bitcoin::Witness" if is_ref => Some("&"),
@@ -1188,26 +1191,28 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
11881191
"bitcoin::TxIn"|"bitcoin::blockdata::transaction::TxIn" if !is_ref => Some(""),
11891192
"bitcoin::TxOut"|"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some(""),
11901193
"bitcoin::network::constants::Network" => Some(""),
1191-
"bitcoin::util::address::WitnessVersion" => Some(""),
1192-
"bitcoin::blockdata::block::BlockHeader" => Some("&::bitcoin::consensus::encode::deserialize(unsafe { &*"),
1194+
"bitcoin::address::WitnessVersion" => Some(""),
1195+
"bitcoin::address::WitnessProgram" if is_ref => Some("&"),
1196+
"bitcoin::address::WitnessProgram" if !is_ref => Some(""),
1197+
"bitcoin::blockdata::block::Header" => Some("&::bitcoin::consensus::encode::deserialize(unsafe { &*"),
11931198
"bitcoin::blockdata::block::Block" if is_ref => Some("&::bitcoin::consensus::encode::deserialize("),
11941199

1195-
"bitcoin::PackedLockTime"|"bitcoin::blockdata::locktime::PackedLockTime" => Some("::bitcoin::PackedLockTime("),
1200+
"bitcoin::blockdata::locktime::absolute::LockTime" => Some("::bitcoin::blockdata::locktime::absolute::LockTime::from_consensus("),
11961201

1197-
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some("::bitcoin::consensus::encode::deserialize("),
1202+
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some("::bitcoin::psbt::PartiallySignedTransaction::deserialize("),
11981203

11991204
"bitcoin::PubkeyHash"|"bitcoin::hash_types::PubkeyHash" if !is_ref =>
1200-
Some("bitcoin::hash_types::PubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner("),
1205+
Some("bitcoin::hash_types::PubkeyHash::from_raw_hash(bitcoin::hashes::Hash::from_byte_array("),
12011206
"bitcoin::PubkeyHash"|"bitcoin::hash_types::PubkeyHash" if is_ref =>
1202-
Some("&bitcoin::hash_types::PubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *"),
1207+
Some("&bitcoin::hash_types::PubkeyHash::from_raw_hash(bitcoin::hashes::Hash::from_byte_array(unsafe { *"),
12031208
"bitcoin::hash_types::WPubkeyHash" if is_ref =>
1204-
Some("&bitcoin::hash_types::WPubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *"),
1209+
Some("&bitcoin::hash_types::WPubkeyHash::from_raw_hash(bitcoin::hashes::Hash::from_byte_array(unsafe { *"),
12051210
"bitcoin::ScriptHash"|"bitcoin::hash_types::ScriptHash" if !is_ref =>
1206-
Some("bitcoin::hash_types::ScriptHash::from_hash(bitcoin::hashes::Hash::from_inner("),
1211+
Some("bitcoin::hash_types::ScriptHash::from_raw_hash(bitcoin::hashes::Hash::from_byte_array("),
12071212
"bitcoin::ScriptHash"|"bitcoin::hash_types::ScriptHash" if is_ref =>
1208-
Some("&bitcoin::hash_types::ScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *"),
1213+
Some("&bitcoin::hash_types::ScriptHash::from_raw_hash(bitcoin::hashes::Hash::from_byte_array(unsafe { *"),
12091214
"bitcoin::hash_types::WScriptHash" if is_ref =>
1210-
Some("&bitcoin::hash_types::WScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *"),
1215+
Some("&bitcoin::hash_types::WScriptHash::from_raw_hash(bitcoin::hashes::Hash::from_byte_array(unsafe { *"),
12111216

12121217
// Newtypes that we just expose in their original form.
12131218
"bitcoin::hash_types::Txid" if is_ref => Some("&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*"),
@@ -1287,19 +1292,20 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
12871292
"bitcoin::secp256k1::Scalar" => Some(".into_rust()"),
12881293
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some(".data)"),
12891294

1290-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if is_ref => Some(".to_slice()))"),
1291-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if !is_ref => Some(".into_rust())"),
1295+
"bitcoin::blockdata::script::Script"|"bitcoin::Script" => Some(".to_slice())"),
1296+
"bitcoin::blockdata::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some(".into_rust())"),
12921297
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some(".into_bitcoin()"),
12931298
"bitcoin::Witness" => Some(".into_bitcoin()"),
12941299
"bitcoin::OutPoint"|"bitcoin::blockdata::transaction::OutPoint" => Some(")"),
12951300
"bitcoin::TxIn"|"bitcoin::blockdata::transaction::TxIn" if !is_ref => Some(".into_rust()"),
12961301
"bitcoin::TxOut"|"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some(".into_rust()"),
12971302
"bitcoin::network::constants::Network" => Some(".into_bitcoin()"),
1298-
"bitcoin::util::address::WitnessVersion" => Some(".into()"),
1299-
"bitcoin::blockdata::block::BlockHeader" => Some(" }).unwrap()"),
1303+
"bitcoin::address::WitnessVersion" => Some(".into()"),
1304+
"bitcoin::address::WitnessProgram" => Some(".into_bitcoin()"),
1305+
"bitcoin::blockdata::block::Header" => Some(" }).unwrap()"),
13001306
"bitcoin::blockdata::block::Block" => Some(".to_slice()).unwrap()"),
13011307

1302-
"bitcoin::PackedLockTime"|"bitcoin::blockdata::locktime::PackedLockTime" => Some(")"),
1308+
"bitcoin::blockdata::locktime::absolute::LockTime" => Some(")"),
13031309

13041310
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some(".as_slice()).expect(\"Invalid PSBT format\")"),
13051311

@@ -1316,7 +1322,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
13161322
"bitcoin::hash_types::Txid" if is_ref => Some(" }[..]).unwrap()"),
13171323
"bitcoin::hash_types::Txid" => Some(".data[..]).unwrap()"),
13181324
"bitcoin::hash_types::BlockHash"|"bitcoin::BlockHash" if !is_ref => Some(".data[..]).unwrap()"),
1319-
"bitcoin::blockdata::constants::ChainHash" if !is_ref => Some(".data[..])"),
1325+
"bitcoin::blockdata::constants::ChainHash" if !is_ref => Some(".data)"),
13201326
"lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret"
13211327
|"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId"
13221328
|"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId"
@@ -1343,9 +1349,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
13431349
"[u8]" if is_ref => Some(("crate::c_types::u8slice::from_slice(", ")")),
13441350
"[usize]" if is_ref => Some(("crate::c_types::usizeslice::from_slice(", ")")),
13451351

1346-
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some(("{ let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(", ")); s }")),
1352+
"bitcoin::blockdata::block::Header" if is_ref => Some(("{ let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(", ")); s }")),
13471353
"bitcoin::blockdata::block::Block" if is_ref => Some(("::bitcoin::consensus::encode::serialize(", ")")),
1348-
"bitcoin::hash_types::Txid" => None,
13491354

13501355
_ => None,
13511356
}.map(|s| s.to_owned())
@@ -1405,8 +1410,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
14051410
"bitcoin::secp256k1::Scalar" if !is_ref => Some("crate::c_types::BigEndianScalar::from_rust(&"),
14061411
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
14071412

1408-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if is_ref => Some("crate::c_types::u8slice::from_slice(&"),
1409-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if !is_ref => Some(""),
1413+
"bitcoin::blockdata::script::Script"|"bitcoin::Script" => Some("crate::c_types::u8slice::from_slice("),
1414+
"bitcoin::blockdata::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some(""),
14101415
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" if is_ref => Some("crate::c_types::Transaction::from_bitcoin("),
14111416
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some("crate::c_types::Transaction::from_bitcoin(&"),
14121417
"bitcoin::Witness" if is_ref => Some("crate::c_types::Witness::from_bitcoin("),
@@ -1417,27 +1422,27 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
14171422
"bitcoin::TxOut"|"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some("crate::c_types::TxOut::from_rust(&"),
14181423
"bitcoin::TxOut"|"bitcoin::blockdata::transaction::TxOut" if is_ref => Some("crate::c_types::TxOut::from_rust("),
14191424
"bitcoin::network::constants::Network" => Some("crate::bitcoin::network::Network::from_bitcoin("),
1420-
"bitcoin::util::address::WitnessVersion" => Some(""),
1421-
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some("&local_"),
1425+
"bitcoin::address::WitnessVersion" => Some(""),
1426+
"bitcoin::address::WitnessProgram" => Some("crate::c_types::WitnessProgram::from_bitcoin("),
1427+
"bitcoin::blockdata::block::Header" if is_ref => Some("&local_"),
14221428
"bitcoin::blockdata::block::Block" if is_ref => Some("crate::c_types::u8slice::from_slice(&local_"),
14231429

1424-
"bitcoin::PackedLockTime"|"bitcoin::blockdata::locktime::PackedLockTime" => Some(""),
1430+
"bitcoin::blockdata::locktime::absolute::LockTime" => Some(""),
14251431

1426-
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some("::bitcoin::consensus::encode::serialize(&"),
1427-
1428-
"bitcoin::hash_types::Txid" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
1432+
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some(""),
14291433

14301434
"bitcoin::PubkeyHash"|"bitcoin::hash_types::PubkeyHash"|
14311435
"bitcoin::hash_types::WPubkeyHash"|"bitcoin::hash_types::WScriptHash"|
14321436
"bitcoin::ScriptHash"|"bitcoin::hash_types::ScriptHash"
1433-
if !is_ref => Some("crate::c_types::TwentyBytes { data: "),
1437+
if !is_ref => Some("crate::c_types::TwentyBytes { data: *"),
14341438

14351439
// Newtypes that we just expose in their original form.
1436-
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1440+
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin::hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
14371441
if is_ref => Some(""),
1438-
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1439-
if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
1442+
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin::hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1443+
if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: *"),
14401444
"bitcoin::secp256k1::Message" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "),
1445+
"bitcoin::secp256k1::Message" if is_ref => Some(""),
14411446
"lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret"
14421447
|"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId"
14431448
|"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId"
@@ -1508,37 +1513,36 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
15081513
"bitcoin::secp256k1::Scalar" if !is_ref => Some(")"),
15091514
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some(".secret_bytes() }"),
15101515

1511-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if is_ref => Some("[..])"),
1512-
"bitcoin::blockdata::script::Script"|"bitcoin::Script" if !is_ref => Some(".into_bytes().into()"),
1516+
"bitcoin::blockdata::script::Script"|"bitcoin::Script" => Some(".as_ref())"),
1517+
"bitcoin::blockdata::script::ScriptBuf"|"bitcoin::ScriptBuf" if is_ref => Some(".as_bytes().to_vec().into()"),
1518+
"bitcoin::blockdata::script::ScriptBuf"|"bitcoin::ScriptBuf" if !is_ref => Some(".to_bytes().into()"),
15131519
"bitcoin::blockdata::transaction::Transaction"|"bitcoin::Transaction" => Some(")"),
15141520
"bitcoin::Witness" => Some(")"),
15151521
"bitcoin::OutPoint"|"bitcoin::blockdata::transaction::OutPoint" => Some(")"),
15161522
"bitcoin::TxIn"|"bitcoin::blockdata::transaction::TxIn" if !is_ref => Some(")"),
15171523
"bitcoin::TxOut"|"bitcoin::blockdata::transaction::TxOut" => Some(")"),
15181524
"bitcoin::network::constants::Network" => Some(")"),
1519-
"bitcoin::util::address::WitnessVersion" => Some(".into()"),
1520-
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some(""),
1525+
"bitcoin::address::WitnessVersion" => Some(".into()"),
1526+
"bitcoin::address::WitnessProgram" => Some(")"),
1527+
"bitcoin::blockdata::block::Header" if is_ref => Some(""),
15211528
"bitcoin::blockdata::block::Block" if is_ref => Some(")"),
15221529

1523-
"bitcoin::PackedLockTime"|"bitcoin::blockdata::locktime::PackedLockTime" => Some(".0"),
1524-
1525-
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some(").into()"),
1530+
"bitcoin::blockdata::locktime::absolute::LockTime" => Some(".to_consensus_u32()"),
15261531

1527-
"bitcoin::hash_types::Txid" if !is_ref => Some(".into_inner() }"),
1532+
"bitcoin::psbt::PartiallySignedTransaction" if !is_ref => Some(".serialize().into()"),
15281533

15291534
"bitcoin::PubkeyHash"|"bitcoin::hash_types::PubkeyHash"|
15301535
"bitcoin::hash_types::WPubkeyHash"|"bitcoin::hash_types::WScriptHash"|
15311536
"bitcoin::ScriptHash"|"bitcoin::hash_types::ScriptHash"
1532-
if !is_ref => Some(".as_hash().into_inner() }"),
1537+
if !is_ref => Some(".as_ref() }"),
15331538

15341539
// Newtypes that we just expose in their original form.
1535-
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"
1536-
if is_ref => Some(".as_inner()"),
1537-
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin_hashes::sha256::Hash"
1538-
if !is_ref => Some(".into_inner() }"),
1539-
"bitcoin::blockdata::constants::ChainHash" if is_ref => Some(".as_bytes()"),
1540-
"bitcoin::blockdata::constants::ChainHash" if !is_ref => Some(".to_bytes() }"),
1540+
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin::hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1541+
if is_ref => Some(".as_ref()"),
1542+
"bitcoin::hash_types::Txid"|"bitcoin::BlockHash"|"bitcoin::hash_types::BlockHash"|"bitcoin::hashes::sha256::Hash"|"bitcoin::blockdata::constants::ChainHash"
1543+
if !is_ref => Some(".as_ref() }"),
15411544
"bitcoin::secp256k1::Message" if !is_ref => Some(".as_ref().clone() }"),
1545+
"bitcoin::secp256k1::Message" if is_ref => Some(".as_ref()"),
15421546
"lightning::ln::PaymentHash"|"lightning::ln::PaymentPreimage"|"lightning::ln::PaymentSecret"
15431547
|"lightning::ln::channelmanager::PaymentId"|"lightning::ln::channelmanager::InterceptId"
15441548
|"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId"

lightning-c-bindings/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ no-std = ["bitcoin/no-std", "lightning/no-std", "lightning-invoice/no-std", "lig
1919
std = ["bitcoin/std", "lightning/std", "lightning-invoice/std", "lightning-background-processor/std"]
2020

2121
[dependencies]
22-
bitcoin = { version = "0.29", default-features = false }
23-
secp256k1 = { version = "0.24", features = ["global-context", "recovery"] }
22+
bitcoin = { version = "0.30", default-features = false }
23+
secp256k1 = { version = "0.27", features = ["global-context", "recovery"] }
2424
# Note that the following line is matched by genbindings to update the path
2525
lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.118-bindings", default-features = false }
2626
lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.0.118-bindings", default-features = false }

lightning-c-bindings/src/bitcoin/network.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ impl Network {
3030
BitcoinNetwork::Testnet => Network::Testnet,
3131
BitcoinNetwork::Regtest => Network::Regtest,
3232
BitcoinNetwork::Signet => Network::Signet,
33+
_ => unreachable!(),
3334
}
3435
}
3536
}

0 commit comments

Comments
 (0)