Skip to content

Commit d4ebc84

Browse files
authored
Merge pull request #115 from TheBlueMatt/main
2 parents 13cdf8b + 63069bb commit d4ebc84

File tree

8 files changed

+2418
-1589
lines changed

8 files changed

+2418
-1589
lines changed

genbindings.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,13 @@ def create_getter(struct_name, field_decl, field_name, accessor, check_sfx):
816816
owned_fn_defn = field_decl + " " + struct_name.replace("LDK", "") + "_get_" + field_name + "(" + struct_name + " *NONNULL_PTR owner)"
817817

818818
holds_ref = False
819-
if field_ty.rust_obj is not None and field_ty.rust_obj.replace("LDK", "") + "_clone" in clone_fns:
819+
if field_ty.rust_obj is not None and field_ty.rust_obj in opaque_structs:
820+
fn_defn = owned_fn_defn
821+
write_c("static inline " + fn_defn + "{\n")
822+
write_c("\t" + field_ty.rust_obj + " ret = " + accessor[0] + "owner" + accessor[1] + ";\n")
823+
write_c("\tret.is_owned = false;\n")
824+
write_c("\treturn ret;\n")
825+
elif field_ty.rust_obj is not None and field_ty.rust_obj.replace("LDK", "") + "_clone" in clone_fns:
820826
fn_defn = owned_fn_defn
821827
write_c("static inline " + fn_defn + "{\n")
822828
if check_sfx is not None:

src/main/java/org/ldk/impl/bindings.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ public final static class None extends LDKCOption_u32Z {
173173
public static native long CResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(long owner);
174174
// struct LDKDecodeError CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR owner);
175175
public static native long CResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(long owner);
176-
// struct LDKTrustedClosingTransaction *CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner);
176+
// struct LDKTrustedClosingTransaction CResult_TrustedClosingTransactionNoneZ_get_ok(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner);
177177
public static native long CResult_TrustedClosingTransactionNoneZ_get_ok(long owner);
178178
// void CResult_TrustedClosingTransactionNoneZ_get_err(LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR owner);
179179
public static native void CResult_TrustedClosingTransactionNoneZ_get_err(long owner);
180180
// struct LDKCommitmentTransaction CResult_CommitmentTransactionDecodeErrorZ_get_ok(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner);
181181
public static native long CResult_CommitmentTransactionDecodeErrorZ_get_ok(long owner);
182182
// struct LDKDecodeError CResult_CommitmentTransactionDecodeErrorZ_get_err(LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR owner);
183183
public static native long CResult_CommitmentTransactionDecodeErrorZ_get_err(long owner);
184-
// struct LDKTrustedCommitmentTransaction *CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner);
184+
// struct LDKTrustedCommitmentTransaction CResult_TrustedCommitmentTransactionNoneZ_get_ok(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner);
185185
public static native long CResult_TrustedCommitmentTransactionNoneZ_get_ok(long owner);
186186
// void CResult_TrustedCommitmentTransactionNoneZ_get_err(LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR owner);
187187
public static native void CResult_TrustedCommitmentTransactionNoneZ_get_err(long owner);
@@ -734,7 +734,7 @@ public interface LDKLogger {
734734
void log(long record);
735735
}
736736
public static native long LDKLogger_new(LDKLogger impl);
737-
// struct LDKProbabilisticScorer *CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner);
737+
// struct LDKProbabilisticScorer CResult_ProbabilisticScorerDecodeErrorZ_get_ok(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner);
738738
public static native long CResult_ProbabilisticScorerDecodeErrorZ_get_ok(long owner);
739739
// struct LDKDecodeError CResult_ProbabilisticScorerDecodeErrorZ_get_err(LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR owner);
740740
public static native long CResult_ProbabilisticScorerDecodeErrorZ_get_err(long owner);
@@ -855,7 +855,7 @@ public final static class Hostname extends LDKNetAddress {
855855
public static native long CResult_NodeInfoDecodeErrorZ_get_ok(long owner);
856856
// struct LDKDecodeError CResult_NodeInfoDecodeErrorZ_get_err(LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR owner);
857857
public static native long CResult_NodeInfoDecodeErrorZ_get_err(long owner);
858-
// struct LDKNetworkGraph *CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner);
858+
// struct LDKNetworkGraph CResult_NetworkGraphDecodeErrorZ_get_ok(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner);
859859
public static native long CResult_NetworkGraphDecodeErrorZ_get_ok(long owner);
860860
// struct LDKDecodeError CResult_NetworkGraphDecodeErrorZ_get_err(LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR owner);
861861
public static native long CResult_NetworkGraphDecodeErrorZ_get_err(long owner);
@@ -1171,7 +1171,7 @@ public interface LDKFeeEstimator {
11711171
public static native int FeeEstimator_get_est_sat_per_1000_weight(long this_arg, ConfirmationTarget confirmation_target);
11721172
// struct LDKThirtyTwoBytes C2Tuple_BlockHashChannelManagerZ_get_a(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner);
11731173
public static native byte[] C2Tuple_BlockHashChannelManagerZ_get_a(long owner);
1174-
// struct LDKChannelManager *C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner);
1174+
// struct LDKChannelManager C2Tuple_BlockHashChannelManagerZ_get_b(LDKC2Tuple_BlockHashChannelManagerZ *NONNULL_PTR owner);
11751175
public static native long C2Tuple_BlockHashChannelManagerZ_get_b(long owner);
11761176
// struct LDKC2Tuple_BlockHashChannelManagerZ *CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR owner);
11771177
public static native long CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_get_ok(long owner);
@@ -1657,7 +1657,7 @@ public final static class None extends LDKCOption_FilterZ {
16571657
}
16581658
static { LDKCOption_FilterZ.init(); }
16591659
public static native LDKCOption_FilterZ LDKCOption_FilterZ_ref_from_ptr(long ptr);
1660-
// struct LDKLockedChannelMonitor *CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner);
1660+
// struct LDKLockedChannelMonitor CResult_LockedChannelMonitorNoneZ_get_ok(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner);
16611661
public static native long CResult_LockedChannelMonitorNoneZ_get_ok(long owner);
16621662
// void CResult_LockedChannelMonitorNoneZ_get_err(LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR owner);
16631663
public static native void CResult_LockedChannelMonitorNoneZ_get_err(long owner);

0 commit comments

Comments
 (0)