@@ -576,6 +576,7 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr
576576 Self :: insert_primitive ( & mut imports, "bool" ) ;
577577 Self :: insert_primitive ( & mut imports, "u128" ) ;
578578 Self :: insert_primitive ( & mut imports, "i64" ) ;
579+ Self :: insert_primitive ( & mut imports, "i32" ) ;
579580 Self :: insert_primitive ( & mut imports, "f64" ) ;
580581 Self :: insert_primitive ( & mut imports, "u64" ) ;
581582 Self :: insert_primitive ( & mut imports, "u32" ) ;
@@ -917,6 +918,11 @@ fn initial_clonable_types() -> HashSet<String> {
917918 // `write_c_mangled_container_path_intern` (which will add it here too), so we have to manually
918919 // add it on startup.
919920 res. insert ( "crate::c_types::derived::CVec_u8Z" . to_owned ( ) ) ;
921+
922+ // write_c_type_intern writes the empty string for the empty tuple. In order to ensure
923+ // COption_NoneZ is marked clonable, we have to support "cloning" "".
924+ res. insert ( "" . to_owned ( ) ) ;
925+
920926 res
921927}
922928
@@ -1037,6 +1043,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
10371043 match full_path {
10381044 "bool" => true ,
10391045 "i64" => true ,
1046+ "i32" => true ,
10401047 "f64" => true ,
10411048 "u64" => true ,
10421049 "u32" => true ,
@@ -1110,7 +1117,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
11101117 "bitcoin::secp256k1::Scalar" if !is_ref => Some ( "crate::c_types::BigEndianScalar" ) ,
11111118 "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( "crate::c_types::ThirtyTwoBytes" ) ,
11121119
1113- "bitcoin::amount::Amount" => Some ( "u64" ) ,
1120+ "bitcoin::Amount" |"bitcoin::amount::Amount" => Some ( "u64" ) ,
1121+ "bitcoin::Weight" => Some ( "u64" ) ,
1122+ "bitcoin::Sequence" => Some ( "u32" ) ,
11141123
11151124 "bitcoin::script::Script" |"bitcoin::Script" => Some ( "crate::c_types::u8slice" ) ,
11161125 "bitcoin::script::ScriptBuf" |"bitcoin::ScriptBuf" => Some ( "crate::c_types::derived::CVec_u8Z" ) ,
@@ -1230,7 +1239,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
12301239 "bitcoin::secp256k1::Scalar" if !is_ref => Some ( "" ) ,
12311240 "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( "::bitcoin::secp256k1::ecdh::SharedSecret::from_bytes(" ) ,
12321241
1233- "bitcoin::amount::Amount" => Some ( "::bitcoin::amount::Amount::from_sat(" ) ,
1242+ "bitcoin::Amount" |"bitcoin::amount::Amount" => Some ( "::bitcoin::amount::Amount::from_sat(" ) ,
1243+ "bitcoin::Weight" => Some ( "::bitcoin::Weight::from_wu(" ) ,
1244+ "bitcoin::Sequence" => Some ( "::bitcoin::Sequence(" ) ,
12341245
12351246 "bitcoin::script::Script" |"bitcoin::Script" => Some ( "::bitcoin::script::Script::from_bytes(" ) ,
12361247 "bitcoin::script::ScriptBuf" |"bitcoin::ScriptBuf" => Some ( "::bitcoin::script::ScriptBuf::from(" ) ,
@@ -1349,7 +1360,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
13491360 "bitcoin::secp256k1::Scalar" => Some ( ".into_rust()" ) ,
13501361 "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( ".data)" ) ,
13511362
1352- "bitcoin::amount::Amount" => Some ( ")" ) ,
1363+ "bitcoin::Amount" |"bitcoin::amount::Amount" => Some ( ")" ) ,
1364+ "bitcoin::Weight" => Some ( ")" ) ,
1365+ "bitcoin::Sequence" => Some ( ")" ) ,
13531366
13541367 "bitcoin::script::Script" |"bitcoin::Script" => Some ( ".to_slice())" ) ,
13551368 "bitcoin::script::ScriptBuf" |"bitcoin::ScriptBuf" => Some ( ".into_rust())" ) ,
@@ -1481,7 +1494,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
14811494 "bitcoin::secp256k1::Scalar" if !is_ref => Some ( "crate::c_types::BigEndianScalar::from_rust(&" ) ,
14821495 "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( "crate::c_types::ThirtyTwoBytes { data: " ) ,
14831496
1484- "bitcoin::amount::Amount" => Some ( "" ) ,
1497+ "bitcoin::Amount" |"bitcoin::amount::Amount" => Some ( "" ) ,
1498+ "bitcoin::Weight" => Some ( "" ) ,
1499+ "bitcoin::Sequence" => Some ( "" ) ,
14851500
14861501 "bitcoin::script::Script" |"bitcoin::Script" => Some ( "crate::c_types::u8slice::from_slice(" ) ,
14871502 "bitcoin::script::ScriptBuf" |"bitcoin::ScriptBuf" => Some ( "" ) ,
@@ -1594,7 +1609,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
15941609 "bitcoin::secp256k1::Scalar" if !is_ref => Some ( ")" ) ,
15951610 "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some ( ".secret_bytes() }" ) ,
15961611
1597- "bitcoin::amount::Amount" => Some ( ".to_sat()" ) ,
1612+ "bitcoin::Amount" |"bitcoin::amount::Amount" => Some ( ".to_sat()" ) ,
1613+ "bitcoin::Weight" => Some ( ".to_wu()" ) ,
1614+ "bitcoin::Sequence" => Some ( ".0" ) ,
15981615
15991616 "bitcoin::script::Script" |"bitcoin::Script" => Some ( ".as_ref())" ) ,
16001617 "bitcoin::script::ScriptBuf" |"bitcoin::ScriptBuf" if is_ref => Some ( ".as_bytes().to_vec().into()" ) ,
0 commit comments