@@ -810,6 +810,7 @@ fn initial_clonable_types() -> HashSet<String> {
810
810
res. insert ( "crate::c_types::PublicKey" . to_owned ( ) ) ;
811
811
res. insert ( "crate::c_types::Transaction" . to_owned ( ) ) ;
812
812
res. insert ( "crate::c_types::Witness" . to_owned ( ) ) ;
813
+ res. insert ( "crate::c_types::WitnessVersion" . to_owned ( ) ) ;
813
814
res. insert ( "crate::c_types::TxOut" . to_owned ( ) ) ;
814
815
res. insert ( "crate::c_types::Signature" . to_owned ( ) ) ;
815
816
res. insert ( "crate::c_types::RecoverableSignature" . to_owned ( ) ) ;
@@ -977,6 +978,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
977
978
"str" if is_ref => Some ( "crate::c_types::Str" ) ,
978
979
"alloc::string::String" |"String" => Some ( "crate::c_types::Str" ) ,
979
980
981
+ "bitcoin::Address" => Some ( "crate::c_types::Str" ) ,
982
+
980
983
"std::time::Duration" |"core::time::Duration" => Some ( "u64" ) ,
981
984
"std::time::SystemTime" => Some ( "u64" ) ,
982
985
"std::io::Error" |"lightning::io::Error" |"lightning::io::ErrorKind" => Some ( "crate::c_types::IOError" ) ,
@@ -1007,7 +1010,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1007
1010
1008
1011
"bitcoin::blockdata::script::Script" if is_ref => Some ( "crate::c_types::u8slice" ) ,
1009
1012
"bitcoin::blockdata::script::Script" if !is_ref => Some ( "crate::c_types::derived::CVec_u8Z" ) ,
1010
- "bitcoin::blockdata::transaction::OutPoint" => Some ( "crate::lightning::chain::transaction::OutPoint" ) ,
1013
+ "bitcoin::OutPoint" | "bitcoin:: blockdata::transaction::OutPoint" => Some ( "crate::lightning::chain::transaction::OutPoint" ) ,
1011
1014
"bitcoin::blockdata::transaction::Transaction" |"bitcoin::Transaction" => Some ( "crate::c_types::Transaction" ) ,
1012
1015
"bitcoin::Witness" => Some ( "crate::c_types::Witness" ) ,
1013
1016
"bitcoin::TxOut" |"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( "crate::c_types::TxOut" ) ,
@@ -1016,7 +1019,13 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1016
1019
"bitcoin::blockdata::block::BlockHeader" if is_ref => Some ( "*const [u8; 80]" ) ,
1017
1020
"bitcoin::blockdata::block::Block" if is_ref => Some ( "crate::c_types::u8slice" ) ,
1018
1021
1019
- "bitcoin::hash_types::PubkeyHash" |"bitcoin::hash_types::WPubkeyHash" |"bitcoin::hash_types::ScriptHash"
1022
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" |
1023
+ "bitcoin::hash_types::WPubkeyHash" |
1024
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash"
1025
+ if !is_ref => Some ( "crate::c_types::TwentyBytes" ) ,
1026
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" |
1027
+ "bitcoin::hash_types::WPubkeyHash" |
1028
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash"
1020
1029
if is_ref => Some ( "*const [u8; 20]" ) ,
1021
1030
"bitcoin::hash_types::WScriptHash"
1022
1031
if is_ref => Some ( "*const [u8; 32]" ) ,
@@ -1095,6 +1104,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1095
1104
"bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some ( "" ) ,
1096
1105
"bitcoin::secp256k1::SecretKey" if is_ref => Some ( "&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *" ) ,
1097
1106
"bitcoin::secp256k1::SecretKey" if !is_ref => Some ( "" ) ,
1107
+ "bitcoin::secp256k1::Scalar" if is_ref => Some ( "&" ) ,
1098
1108
"bitcoin::secp256k1::Scalar" if !is_ref => Some ( "" ) ,
1099
1109
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( "::bitcoin::secp256k1::ecdh::SharedSecret::from_bytes(" ) ,
1100
1110
@@ -1104,18 +1114,22 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1104
1114
"bitcoin::blockdata::transaction::Transaction" |"bitcoin::Transaction" => Some ( "" ) ,
1105
1115
"bitcoin::Witness" if is_ref => Some ( "&" ) ,
1106
1116
"bitcoin::Witness" => Some ( "" ) ,
1107
- "bitcoin::blockdata::transaction::OutPoint" => Some ( "crate::c_types::C_to_bitcoin_outpoint(" ) ,
1117
+ "bitcoin::OutPoint" | "bitcoin:: blockdata::transaction::OutPoint" => Some ( "crate::c_types::C_to_bitcoin_outpoint(" ) ,
1108
1118
"bitcoin::TxOut" |"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( "" ) ,
1109
1119
"bitcoin::network::constants::Network" => Some ( "" ) ,
1110
1120
"bitcoin::util::address::WitnessVersion" => Some ( "" ) ,
1111
1121
"bitcoin::blockdata::block::BlockHeader" => Some ( "&::bitcoin::consensus::encode::deserialize(unsafe { &*" ) ,
1112
1122
"bitcoin::blockdata::block::Block" if is_ref => Some ( "&::bitcoin::consensus::encode::deserialize(" ) ,
1113
1123
1114
- "bitcoin::hash_types::PubkeyHash" if is_ref =>
1124
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" if !is_ref =>
1125
+ Some ( "bitcoin::hash_types::PubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(" ) ,
1126
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" if is_ref =>
1115
1127
Some ( "&bitcoin::hash_types::PubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *" ) ,
1116
1128
"bitcoin::hash_types::WPubkeyHash" if is_ref =>
1117
1129
Some ( "&bitcoin::hash_types::WPubkeyHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *" ) ,
1118
- "bitcoin::hash_types::ScriptHash" if is_ref =>
1130
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash" if !is_ref =>
1131
+ Some ( "bitcoin::hash_types::ScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(" ) ,
1132
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash" if is_ref =>
1119
1133
Some ( "&bitcoin::hash_types::ScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *" ) ,
1120
1134
"bitcoin::hash_types::WScriptHash" if is_ref =>
1121
1135
Some ( "&bitcoin::hash_types::WScriptHash::from_hash(bitcoin::hashes::Hash::from_inner(unsafe { *" ) ,
@@ -1124,7 +1138,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1124
1138
"bitcoin::hash_types::Txid" if is_ref => Some ( "&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*" ) ,
1125
1139
"bitcoin::hash_types::Txid" if !is_ref => Some ( "::bitcoin::hash_types::Txid::from_slice(&" ) ,
1126
1140
"bitcoin::hash_types::BlockHash" |"bitcoin::BlockHash" => Some ( "::bitcoin::hash_types::BlockHash::from_slice(&" ) ,
1127
- "bitcoin::blockdata::constants::ChainHash" => Some ( "::bitcoin::blockdata::constants::ChainHash::from_slice (&" ) ,
1141
+ "bitcoin::blockdata::constants::ChainHash" => Some ( "::bitcoin::blockdata::constants::ChainHash::from (&" ) ,
1128
1142
"lightning::ln::PaymentHash" if !is_ref => Some ( "::lightning::ln::PaymentHash(" ) ,
1129
1143
"lightning::ln::PaymentHash" if is_ref => Some ( "&::lightning::ln::PaymentHash(unsafe { *" ) ,
1130
1144
"lightning::ln::PaymentPreimage" if !is_ref => Some ( "::lightning::ln::PaymentPreimage(" ) ,
@@ -1189,28 +1203,34 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1189
1203
"bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some ( ".into_rust()" ) ,
1190
1204
"bitcoin::secp256k1::SecretKey" if !is_ref => Some ( ".into_rust()" ) ,
1191
1205
"bitcoin::secp256k1::SecretKey" if is_ref => Some ( "}[..]).unwrap()" ) ,
1192
- "bitcoin::secp256k1::Scalar" if !is_ref => Some ( ".into_rust()" ) ,
1206
+ "bitcoin::secp256k1::Scalar" => Some ( ".into_rust()" ) ,
1193
1207
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( ".data)" ) ,
1194
1208
1195
1209
"bitcoin::blockdata::script::Script" if is_ref => Some ( ".to_slice()))" ) ,
1196
1210
"bitcoin::blockdata::script::Script" if !is_ref => Some ( ".into_rust())" ) ,
1197
1211
"bitcoin::blockdata::transaction::Transaction" |"bitcoin::Transaction" => Some ( ".into_bitcoin()" ) ,
1198
1212
"bitcoin::Witness" => Some ( ".into_bitcoin()" ) ,
1199
- "bitcoin::blockdata::transaction::OutPoint" => Some ( ")" ) ,
1213
+ "bitcoin::OutPoint" | "bitcoin:: blockdata::transaction::OutPoint" => Some ( ")" ) ,
1200
1214
"bitcoin::TxOut" |"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( ".into_rust()" ) ,
1201
1215
"bitcoin::network::constants::Network" => Some ( ".into_bitcoin()" ) ,
1202
1216
"bitcoin::util::address::WitnessVersion" => Some ( ".into()" ) ,
1203
1217
"bitcoin::blockdata::block::BlockHeader" => Some ( " }).unwrap()" ) ,
1204
1218
"bitcoin::blockdata::block::Block" => Some ( ".to_slice()).unwrap()" ) ,
1205
1219
1206
- "bitcoin::hash_types::PubkeyHash" |"bitcoin::hash_types::WPubkeyHash" |
1207
- "bitcoin::hash_types::ScriptHash" |"bitcoin::hash_types::WScriptHash"
1220
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" |
1221
+ "bitcoin::hash_types::WPubkeyHash" |"bitcoin::hash_types::WScriptHash" |
1222
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash"
1223
+ if !is_ref => Some ( ".data))" ) ,
1224
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" |
1225
+ "bitcoin::hash_types::WPubkeyHash" |"bitcoin::hash_types::WScriptHash" |
1226
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash"
1208
1227
if is_ref => Some ( " }.clone()))" ) ,
1209
1228
1210
1229
// Newtypes that we just expose in their original form.
1211
1230
"bitcoin::hash_types::Txid" if is_ref => Some ( " }[..]).unwrap()" ) ,
1212
1231
"bitcoin::hash_types::Txid" => Some ( ".data[..]).unwrap()" ) ,
1213
- "bitcoin::hash_types::BlockHash" |"bitcoin::BlockHash" |"bitcoin::blockdata::constants::ChainHash" if !is_ref => Some ( ".data[..]).unwrap()" ) ,
1232
+ "bitcoin::hash_types::BlockHash" |"bitcoin::BlockHash" if !is_ref => Some ( ".data[..]).unwrap()" ) ,
1233
+ "bitcoin::blockdata::constants::ChainHash" if !is_ref => Some ( ".data[..])" ) ,
1214
1234
"lightning::ln::PaymentHash" |"lightning::ln::PaymentPreimage" |"lightning::ln::PaymentSecret"
1215
1235
|"lightning::ln::channelmanager::PaymentId" |"lightning::ln::channelmanager::InterceptId"
1216
1236
|"lightning::chain::keysinterface::KeyMaterial"
@@ -1266,6 +1286,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1266
1286
"str" if is_ref => Some ( "" ) ,
1267
1287
"alloc::string::String" |"String" => Some ( "" ) ,
1268
1288
1289
+ "bitcoin::Address" => Some ( "alloc::string::ToString::to_string(&" ) ,
1290
+
1269
1291
"std::time::Duration" |"core::time::Duration" => Some ( "" ) ,
1270
1292
"std::time::SystemTime" => Some ( "" ) ,
1271
1293
"std::io::Error" |"lightning::io::Error" => Some ( "crate::c_types::IOError::from_rust(" ) ,
@@ -1290,7 +1312,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1290
1312
"bitcoin::secp256k1::ecdsa::RecoverableSignature" => Some ( "crate::c_types::RecoverableSignature::from_rust(&" ) ,
1291
1313
"bitcoin::secp256k1::SecretKey" if is_ref => Some ( "" ) ,
1292
1314
"bitcoin::secp256k1::SecretKey" if !is_ref => Some ( "crate::c_types::SecretKey::from_rust(" ) ,
1293
- "bitcoin::secp256k1::Scalar" if !is_ref => Some ( "crate::c_types::BigEndianScalar::from_rust(" ) ,
1315
+ "bitcoin::secp256k1::Scalar" if !is_ref => Some ( "crate::c_types::BigEndianScalar::from_rust(& " ) ,
1294
1316
"bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( "crate::c_types::ThirtyTwoBytes { data: " ) ,
1295
1317
1296
1318
"bitcoin::blockdata::script::Script" if is_ref => Some ( "crate::c_types::u8slice::from_slice(&" ) ,
@@ -1299,7 +1321,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1299
1321
"bitcoin::blockdata::transaction::Transaction" |"bitcoin::Transaction" => Some ( "crate::c_types::Transaction::from_bitcoin(&" ) ,
1300
1322
"bitcoin::Witness" if is_ref => Some ( "crate::c_types::Witness::from_bitcoin(" ) ,
1301
1323
"bitcoin::Witness" if !is_ref => Some ( "crate::c_types::Witness::from_bitcoin(&" ) ,
1302
- "bitcoin::blockdata::transaction::OutPoint" => Some ( "crate::c_types::bitcoin_to_C_outpoint(" ) ,
1324
+ "bitcoin::OutPoint" | "bitcoin:: blockdata::transaction::OutPoint" => Some ( "crate::c_types::bitcoin_to_C_outpoint(" ) ,
1303
1325
"bitcoin::TxOut" |"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( "crate::c_types::TxOut::from_rust(" ) ,
1304
1326
"bitcoin::network::constants::Network" => Some ( "crate::bitcoin::network::Network::from_bitcoin(" ) ,
1305
1327
"bitcoin::util::address::WitnessVersion" => Some ( "" ) ,
@@ -1308,6 +1330,11 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1308
1330
1309
1331
"bitcoin::hash_types::Txid" if !is_ref => Some ( "crate::c_types::ThirtyTwoBytes { data: " ) ,
1310
1332
1333
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" |
1334
+ "bitcoin::hash_types::WPubkeyHash" |"bitcoin::hash_types::WScriptHash" |
1335
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash"
1336
+ if !is_ref => Some ( "crate::c_types::TwentyBytes { data: " ) ,
1337
+
1311
1338
// Newtypes that we just expose in their original form.
1312
1339
"bitcoin::hash_types::Txid" |"bitcoin::BlockHash" |"bitcoin::hash_types::BlockHash" |"bitcoin_hashes::sha256::Hash" |"bitcoin::blockdata::constants::ChainHash"
1313
1340
if is_ref => Some ( "" ) ,
@@ -1353,6 +1380,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1353
1380
"alloc::string::String" |"String" if is_ref => Some ( ".as_str().into()" ) ,
1354
1381
"alloc::string::String" |"String" => Some ( ".into()" ) ,
1355
1382
1383
+ "bitcoin::Address" => Some ( ").into()" ) ,
1384
+
1356
1385
"std::time::Duration" |"core::time::Duration" => Some ( ".as_secs()" ) ,
1357
1386
"std::time::SystemTime" => Some ( ".duration_since(::std::time::SystemTime::UNIX_EPOCH).expect(\" Times must be post-1970\" ).as_secs()" ) ,
1358
1387
"std::io::Error" |"lightning::io::Error" |"lightning::io::ErrorKind" => Some ( ")" ) ,
@@ -1383,7 +1412,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1383
1412
"bitcoin::blockdata::script::Script" if !is_ref => Some ( ".into_bytes().into()" ) ,
1384
1413
"bitcoin::blockdata::transaction::Transaction" |"bitcoin::Transaction" => Some ( ")" ) ,
1385
1414
"bitcoin::Witness" => Some ( ")" ) ,
1386
- "bitcoin::blockdata::transaction::OutPoint" => Some ( ")" ) ,
1415
+ "bitcoin::OutPoint" | "bitcoin:: blockdata::transaction::OutPoint" => Some ( ")" ) ,
1387
1416
"bitcoin::TxOut" |"bitcoin::blockdata::transaction::TxOut" if !is_ref => Some ( ")" ) ,
1388
1417
"bitcoin::network::constants::Network" => Some ( ")" ) ,
1389
1418
"bitcoin::util::address::WitnessVersion" => Some ( ".into()" ) ,
@@ -1392,11 +1421,18 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
1392
1421
1393
1422
"bitcoin::hash_types::Txid" if !is_ref => Some ( ".into_inner() }" ) ,
1394
1423
1424
+ "bitcoin::PubkeyHash" |"bitcoin::hash_types::PubkeyHash" |
1425
+ "bitcoin::hash_types::WPubkeyHash" |"bitcoin::hash_types::WScriptHash" |
1426
+ "bitcoin::ScriptHash" |"bitcoin::hash_types::ScriptHash"
1427
+ if !is_ref => Some ( ".as_hash().into_inner() }" ) ,
1428
+
1395
1429
// Newtypes that we just expose in their original form.
1396
- "bitcoin::hash_types::Txid" |"bitcoin::BlockHash" |"bitcoin::hash_types::BlockHash" |"bitcoin_hashes::sha256::Hash" | "bitcoin::blockdata::constants::ChainHash"
1430
+ "bitcoin::hash_types::Txid" |"bitcoin::BlockHash" |"bitcoin::hash_types::BlockHash" |"bitcoin_hashes::sha256::Hash"
1397
1431
if is_ref => Some ( ".as_inner()" ) ,
1398
- "bitcoin::hash_types::Txid" |"bitcoin::BlockHash" |"bitcoin::hash_types::BlockHash" |"bitcoin_hashes::sha256::Hash" | "bitcoin::blockdata::constants::ChainHash"
1432
+ "bitcoin::hash_types::Txid" |"bitcoin::BlockHash" |"bitcoin::hash_types::BlockHash" |"bitcoin_hashes::sha256::Hash"
1399
1433
if !is_ref => Some ( ".into_inner() }" ) ,
1434
+ "bitcoin::blockdata::constants::ChainHash" if is_ref => Some ( ".as_bytes() }" ) ,
1435
+ "bitcoin::blockdata::constants::ChainHash" if !is_ref => Some ( ".to_bytes() }" ) ,
1400
1436
"bitcoin::secp256k1::Message" if !is_ref => Some ( ".as_ref().clone() }" ) ,
1401
1437
"lightning::ln::PaymentHash" |"lightning::ln::PaymentPreimage" |"lightning::ln::PaymentSecret"
1402
1438
|"lightning::ln::channelmanager::PaymentId" |"lightning::ln::channelmanager::InterceptId"
0 commit comments