Expose signatures as byte[], check array lengths in C.
[ldk-java] / src / main / java / org / ldk / impl / bindings.java
index a02f42266b17d92890a054e0496d089233f9ffbb..d0a39204719bc660e831cffaa4a420eea666403f 100644 (file)
@@ -45,8 +45,7 @@ public class bindings {
        public static native long LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_new(byte[] a, long b);
        public static native long LDKC2TupleTempl_u64__u64_new(long a, long b);
        public static native VecOrSliceDef LDKCVecTempl_Signature_arr_info(long vec_ptr);
-       public static native long LDKCVecTempl_Signature_new(long[] elems);
-       public static native long LDKC2TupleTempl_Signature__CVecTempl_Signature_new(long a, long b);
+       public static native long LDKC2TupleTempl_Signature__CVecTempl_Signature_new(byte[] a, long b);
        public static native boolean LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(long arg);
        public static native long LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_inner(long arg);
        public static native boolean LDKCResult_SignatureNoneZ_result_ok(long arg);
@@ -85,7 +84,7 @@ public class bindings {
        public static native long LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate_new(long a, long b, long c);
        public static native boolean LDKCResult_NonePeerHandleErrorZ_result_ok(long arg);
        public static native long LDKCResult_NonePeerHandleErrorZ_get_inner(long arg);
-       public static native long LDKC2TupleTempl_HTLCOutputInCommitment__Signature_new(long a, long b);
+       public static native long LDKC2TupleTempl_HTLCOutputInCommitment__Signature_new(long a, byte[] b);
        public static class LDKSpendableOutputDescriptor {
                private LDKSpendableOutputDescriptor() {}
                public final static class StaticOutput extends LDKSpendableOutputDescriptor {
@@ -649,7 +648,7 @@ public class bindings {
        // extern const void (*CResult_SignatureNoneZ_free)(LDKCResult_SignatureNoneZ);
        public static native void CResult_SignatureNoneZ_free(long arg);
        // extern const LDKCResult_SignatureNoneZ (*CResult_SignatureNoneZ_ok)(LDKSignature);
-       public static native long CResult_SignatureNoneZ_ok(long arg);
+       public static native long CResult_SignatureNoneZ_ok(byte[] arg);
        // extern const LDKCResult_TxCreationKeysSecpErrorZ (*CResult_TxCreationKeysSecpErrorZ_err)(LDKSecp256k1Error);
        public static native long CResult_TxCreationKeysSecpErrorZ_err(LDKSecp256k1Error arg);
        // extern const void (*CResult_TxCreationKeysSecpErrorZ_free)(LDKCResult_TxCreationKeysSecpErrorZ);
@@ -743,7 +742,7 @@ public class bindings {
        // LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b);
        public static native long C2Tuple_u64u64Z_new(long a, long b);
        // LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(LDKSignature a, LDKCVec_SignatureZ b);
-       public static native long C2Tuple_SignatureCVec_SignatureZZ_new(long a, long b);
+       public static native long C2Tuple_SignatureCVec_SignatureZZ_new(byte[] a, long b);
        // LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
        public static native long CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
        // LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
@@ -759,7 +758,7 @@ public class bindings {
        // LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
        public static native long CResult_NonePeerHandleErrorZ_ok();
        // LDKC2Tuple_HTLCOutputInCommitmentSignatureZ C2Tuple_HTLCOutputInCommitmentSignatureZ_new(LDKHTLCOutputInCommitment a, LDKSignature b);
-       public static native long C2Tuple_HTLCOutputInCommitmentSignatureZ_new(long a, long b);
+       public static native long C2Tuple_HTLCOutputInCommitmentSignatureZ_new(long a, byte[] b);
        // void Event_free(LDKEvent this_ptr);
        public static native void Event_free(long this_ptr);
        // void MessageSendEvent_free(LDKMessageSendEvent this_ptr);
@@ -1325,11 +1324,11 @@ public class bindings {
        // void FundingCreated_set_funding_output_index(LDKFundingCreated *this_ptr, uint16_t val);
        public static native void FundingCreated_set_funding_output_index(long this_ptr, short val);
        // LDKSignature FundingCreated_get_signature(const LDKFundingCreated *this_ptr);
-       public static native long FundingCreated_get_signature(long this_ptr);
+       public static native byte[] FundingCreated_get_signature(long this_ptr);
        // void FundingCreated_set_signature(LDKFundingCreated *this_ptr, LDKSignature val);
-       public static native void FundingCreated_set_signature(long this_ptr, long val);
+       public static native void FundingCreated_set_signature(long this_ptr, byte[] val);
        // MUST_USE_RES LDKFundingCreated FundingCreated_new(LDKThirtyTwoBytes temporary_channel_id_arg, LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, LDKSignature signature_arg);
-       public static native long FundingCreated_new(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, long signature_arg);
+       public static native long FundingCreated_new(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg);
        // void FundingSigned_free(LDKFundingSigned this_ptr);
        public static native void FundingSigned_free(long this_ptr);
        // LDKFundingSigned FundingSigned_clone(const LDKFundingSigned *orig);
@@ -1339,11 +1338,11 @@ public class bindings {
        // void FundingSigned_set_channel_id(LDKFundingSigned *this_ptr, LDKThirtyTwoBytes val);
        public static native void FundingSigned_set_channel_id(long this_ptr, byte[] val);
        // LDKSignature FundingSigned_get_signature(const LDKFundingSigned *this_ptr);
-       public static native long FundingSigned_get_signature(long this_ptr);
+       public static native byte[] FundingSigned_get_signature(long this_ptr);
        // void FundingSigned_set_signature(LDKFundingSigned *this_ptr, LDKSignature val);
-       public static native void FundingSigned_set_signature(long this_ptr, long val);
+       public static native void FundingSigned_set_signature(long this_ptr, byte[] val);
        // MUST_USE_RES LDKFundingSigned FundingSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg);
-       public static native long FundingSigned_new(byte[] channel_id_arg, long signature_arg);
+       public static native long FundingSigned_new(byte[] channel_id_arg, byte[] signature_arg);
        // void FundingLocked_free(LDKFundingLocked this_ptr);
        public static native void FundingLocked_free(long this_ptr);
        // LDKFundingLocked FundingLocked_clone(const LDKFundingLocked *orig);
@@ -1385,11 +1384,11 @@ public class bindings {
        // void ClosingSigned_set_fee_satoshis(LDKClosingSigned *this_ptr, uint64_t val);
        public static native void ClosingSigned_set_fee_satoshis(long this_ptr, long val);
        // LDKSignature ClosingSigned_get_signature(const LDKClosingSigned *this_ptr);
-       public static native long ClosingSigned_get_signature(long this_ptr);
+       public static native byte[] ClosingSigned_get_signature(long this_ptr);
        // void ClosingSigned_set_signature(LDKClosingSigned *this_ptr, LDKSignature val);
-       public static native void ClosingSigned_set_signature(long this_ptr, long val);
+       public static native void ClosingSigned_set_signature(long this_ptr, byte[] val);
        // MUST_USE_RES LDKClosingSigned ClosingSigned_new(LDKThirtyTwoBytes channel_id_arg, uint64_t fee_satoshis_arg, LDKSignature signature_arg);
-       public static native long ClosingSigned_new(byte[] channel_id_arg, long fee_satoshis_arg, long signature_arg);
+       public static native long ClosingSigned_new(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg);
        // void UpdateAddHTLC_free(LDKUpdateAddHTLC this_ptr);
        public static native void UpdateAddHTLC_free(long this_ptr);
        // LDKUpdateAddHTLC UpdateAddHTLC_clone(const LDKUpdateAddHTLC *orig);
@@ -1469,13 +1468,13 @@ public class bindings {
        // void CommitmentSigned_set_channel_id(LDKCommitmentSigned *this_ptr, LDKThirtyTwoBytes val);
        public static native void CommitmentSigned_set_channel_id(long this_ptr, byte[] val);
        // LDKSignature CommitmentSigned_get_signature(const LDKCommitmentSigned *this_ptr);
-       public static native long CommitmentSigned_get_signature(long this_ptr);
+       public static native byte[] CommitmentSigned_get_signature(long this_ptr);
        // void CommitmentSigned_set_signature(LDKCommitmentSigned *this_ptr, LDKSignature val);
-       public static native void CommitmentSigned_set_signature(long this_ptr, long val);
+       public static native void CommitmentSigned_set_signature(long this_ptr, byte[] val);
        // void CommitmentSigned_set_htlc_signatures(LDKCommitmentSigned *this_ptr, LDKCVec_SignatureZ val);
        public static native void CommitmentSigned_set_htlc_signatures(long this_ptr, long val);
        // MUST_USE_RES LDKCommitmentSigned CommitmentSigned_new(LDKThirtyTwoBytes channel_id_arg, LDKSignature signature_arg, LDKCVec_SignatureZ htlc_signatures_arg);
-       public static native long CommitmentSigned_new(byte[] channel_id_arg, long signature_arg, long htlc_signatures_arg);
+       public static native long CommitmentSigned_new(byte[] channel_id_arg, byte[] signature_arg, long htlc_signatures_arg);
        // void RevokeAndACK_free(LDKRevokeAndACK this_ptr);
        public static native void RevokeAndACK_free(long this_ptr);
        // LDKRevokeAndACK RevokeAndACK_clone(const LDKRevokeAndACK *orig);
@@ -1551,15 +1550,15 @@ public class bindings {
        // void AnnouncementSignatures_set_short_channel_id(LDKAnnouncementSignatures *this_ptr, uint64_t val);
        public static native void AnnouncementSignatures_set_short_channel_id(long this_ptr, long val);
        // LDKSignature AnnouncementSignatures_get_node_signature(const LDKAnnouncementSignatures *this_ptr);
-       public static native long AnnouncementSignatures_get_node_signature(long this_ptr);
+       public static native byte[] AnnouncementSignatures_get_node_signature(long this_ptr);
        // void AnnouncementSignatures_set_node_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
-       public static native void AnnouncementSignatures_set_node_signature(long this_ptr, long val);
+       public static native void AnnouncementSignatures_set_node_signature(long this_ptr, byte[] val);
        // LDKSignature AnnouncementSignatures_get_bitcoin_signature(const LDKAnnouncementSignatures *this_ptr);
-       public static native long AnnouncementSignatures_get_bitcoin_signature(long this_ptr);
+       public static native byte[] AnnouncementSignatures_get_bitcoin_signature(long this_ptr);
        // void AnnouncementSignatures_set_bitcoin_signature(LDKAnnouncementSignatures *this_ptr, LDKSignature val);
-       public static native void AnnouncementSignatures_set_bitcoin_signature(long this_ptr, long val);
+       public static native void AnnouncementSignatures_set_bitcoin_signature(long this_ptr, byte[] val);
        // MUST_USE_RES LDKAnnouncementSignatures AnnouncementSignatures_new(LDKThirtyTwoBytes channel_id_arg, uint64_t short_channel_id_arg, LDKSignature node_signature_arg, LDKSignature bitcoin_signature_arg);
-       public static native long AnnouncementSignatures_new(byte[] channel_id_arg, long short_channel_id_arg, long node_signature_arg, long bitcoin_signature_arg);
+       public static native long AnnouncementSignatures_new(byte[] channel_id_arg, long short_channel_id_arg, byte[] node_signature_arg, byte[] bitcoin_signature_arg);
        // void NetAddress_free(LDKNetAddress this_ptr);
        public static native void NetAddress_free(long this_ptr);
        // void UnsignedNodeAnnouncement_free(LDKUnsignedNodeAnnouncement this_ptr);
@@ -1593,15 +1592,15 @@ public class bindings {
        // LDKNodeAnnouncement NodeAnnouncement_clone(const LDKNodeAnnouncement *orig);
        public static native long NodeAnnouncement_clone(long orig);
        // LDKSignature NodeAnnouncement_get_signature(const LDKNodeAnnouncement *this_ptr);
-       public static native long NodeAnnouncement_get_signature(long this_ptr);
+       public static native byte[] NodeAnnouncement_get_signature(long this_ptr);
        // void NodeAnnouncement_set_signature(LDKNodeAnnouncement *this_ptr, LDKSignature val);
-       public static native void NodeAnnouncement_set_signature(long this_ptr, long val);
+       public static native void NodeAnnouncement_set_signature(long this_ptr, byte[] val);
        // LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const LDKNodeAnnouncement *this_ptr);
        public static native long NodeAnnouncement_get_contents(long this_ptr);
        // void NodeAnnouncement_set_contents(LDKNodeAnnouncement *this_ptr, LDKUnsignedNodeAnnouncement val);
        public static native void NodeAnnouncement_set_contents(long this_ptr, long val);
        // MUST_USE_RES LDKNodeAnnouncement NodeAnnouncement_new(LDKSignature signature_arg, LDKUnsignedNodeAnnouncement contents_arg);
-       public static native long NodeAnnouncement_new(long signature_arg, long contents_arg);
+       public static native long NodeAnnouncement_new(byte[] signature_arg, long contents_arg);
        // void UnsignedChannelAnnouncement_free(LDKUnsignedChannelAnnouncement this_ptr);
        public static native void UnsignedChannelAnnouncement_free(long this_ptr);
        // LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const LDKUnsignedChannelAnnouncement *orig);
@@ -1639,27 +1638,27 @@ public class bindings {
        // LDKChannelAnnouncement ChannelAnnouncement_clone(const LDKChannelAnnouncement *orig);
        public static native long ChannelAnnouncement_clone(long orig);
        // LDKSignature ChannelAnnouncement_get_node_signature_1(const LDKChannelAnnouncement *this_ptr);
-       public static native long ChannelAnnouncement_get_node_signature_1(long this_ptr);
+       public static native byte[] ChannelAnnouncement_get_node_signature_1(long this_ptr);
        // void ChannelAnnouncement_set_node_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
-       public static native void ChannelAnnouncement_set_node_signature_1(long this_ptr, long val);
+       public static native void ChannelAnnouncement_set_node_signature_1(long this_ptr, byte[] val);
        // LDKSignature ChannelAnnouncement_get_node_signature_2(const LDKChannelAnnouncement *this_ptr);
-       public static native long ChannelAnnouncement_get_node_signature_2(long this_ptr);
+       public static native byte[] ChannelAnnouncement_get_node_signature_2(long this_ptr);
        // void ChannelAnnouncement_set_node_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
-       public static native void ChannelAnnouncement_set_node_signature_2(long this_ptr, long val);
+       public static native void ChannelAnnouncement_set_node_signature_2(long this_ptr, byte[] val);
        // LDKSignature ChannelAnnouncement_get_bitcoin_signature_1(const LDKChannelAnnouncement *this_ptr);
-       public static native long ChannelAnnouncement_get_bitcoin_signature_1(long this_ptr);
+       public static native byte[] ChannelAnnouncement_get_bitcoin_signature_1(long this_ptr);
        // void ChannelAnnouncement_set_bitcoin_signature_1(LDKChannelAnnouncement *this_ptr, LDKSignature val);
-       public static native void ChannelAnnouncement_set_bitcoin_signature_1(long this_ptr, long val);
+       public static native void ChannelAnnouncement_set_bitcoin_signature_1(long this_ptr, byte[] val);
        // LDKSignature ChannelAnnouncement_get_bitcoin_signature_2(const LDKChannelAnnouncement *this_ptr);
-       public static native long ChannelAnnouncement_get_bitcoin_signature_2(long this_ptr);
+       public static native byte[] ChannelAnnouncement_get_bitcoin_signature_2(long this_ptr);
        // void ChannelAnnouncement_set_bitcoin_signature_2(LDKChannelAnnouncement *this_ptr, LDKSignature val);
-       public static native void ChannelAnnouncement_set_bitcoin_signature_2(long this_ptr, long val);
+       public static native void ChannelAnnouncement_set_bitcoin_signature_2(long this_ptr, byte[] val);
        // LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const LDKChannelAnnouncement *this_ptr);
        public static native long ChannelAnnouncement_get_contents(long this_ptr);
        // void ChannelAnnouncement_set_contents(LDKChannelAnnouncement *this_ptr, LDKUnsignedChannelAnnouncement val);
        public static native void ChannelAnnouncement_set_contents(long this_ptr, long val);
        // MUST_USE_RES LDKChannelAnnouncement ChannelAnnouncement_new(LDKSignature node_signature_1_arg, LDKSignature node_signature_2_arg, LDKSignature bitcoin_signature_1_arg, LDKSignature bitcoin_signature_2_arg, LDKUnsignedChannelAnnouncement contents_arg);
-       public static native long ChannelAnnouncement_new(long node_signature_1_arg, long node_signature_2_arg, long bitcoin_signature_1_arg, long bitcoin_signature_2_arg, long contents_arg);
+       public static native long ChannelAnnouncement_new(byte[] node_signature_1_arg, byte[] node_signature_2_arg, byte[] bitcoin_signature_1_arg, byte[] bitcoin_signature_2_arg, long contents_arg);
        // void UnsignedChannelUpdate_free(LDKUnsignedChannelUpdate this_ptr);
        public static native void UnsignedChannelUpdate_free(long this_ptr);
        // LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const LDKUnsignedChannelUpdate *orig);
@@ -1701,15 +1700,15 @@ public class bindings {
        // LDKChannelUpdate ChannelUpdate_clone(const LDKChannelUpdate *orig);
        public static native long ChannelUpdate_clone(long orig);
        // LDKSignature ChannelUpdate_get_signature(const LDKChannelUpdate *this_ptr);
-       public static native long ChannelUpdate_get_signature(long this_ptr);
+       public static native byte[] ChannelUpdate_get_signature(long this_ptr);
        // void ChannelUpdate_set_signature(LDKChannelUpdate *this_ptr, LDKSignature val);
-       public static native void ChannelUpdate_set_signature(long this_ptr, long val);
+       public static native void ChannelUpdate_set_signature(long this_ptr, byte[] val);
        // LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const LDKChannelUpdate *this_ptr);
        public static native long ChannelUpdate_get_contents(long this_ptr);
        // void ChannelUpdate_set_contents(LDKChannelUpdate *this_ptr, LDKUnsignedChannelUpdate val);
        public static native void ChannelUpdate_set_contents(long this_ptr, long val);
        // MUST_USE_RES LDKChannelUpdate ChannelUpdate_new(LDKSignature signature_arg, LDKUnsignedChannelUpdate contents_arg);
-       public static native long ChannelUpdate_new(long signature_arg, long contents_arg);
+       public static native long ChannelUpdate_new(byte[] signature_arg, long contents_arg);
        // void QueryChannelRange_free(LDKQueryChannelRange this_ptr);
        public static native void QueryChannelRange_free(long this_ptr);
        // LDKQueryChannelRange QueryChannelRange_clone(const LDKQueryChannelRange *orig);
@@ -2125,9 +2124,9 @@ public class bindings {
        // void HolderCommitmentTransaction_set_unsigned_tx(LDKHolderCommitmentTransaction *this_ptr, LDKTransaction val);
        public static native void HolderCommitmentTransaction_set_unsigned_tx(long this_ptr, long val);
        // LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const LDKHolderCommitmentTransaction *this_ptr);
-       public static native long HolderCommitmentTransaction_get_counterparty_sig(long this_ptr);
+       public static native byte[] HolderCommitmentTransaction_get_counterparty_sig(long this_ptr);
        // void HolderCommitmentTransaction_set_counterparty_sig(LDKHolderCommitmentTransaction *this_ptr, LDKSignature val);
-       public static native void HolderCommitmentTransaction_set_counterparty_sig(long this_ptr, long val);
+       public static native void HolderCommitmentTransaction_set_counterparty_sig(long this_ptr, byte[] val);
        // uint32_t HolderCommitmentTransaction_get_feerate_per_kw(const LDKHolderCommitmentTransaction *this_ptr);
        public static native int HolderCommitmentTransaction_get_feerate_per_kw(long this_ptr);
        // void HolderCommitmentTransaction_set_feerate_per_kw(LDKHolderCommitmentTransaction *this_ptr, uint32_t val);
@@ -2135,13 +2134,13 @@ public class bindings {
        // void HolderCommitmentTransaction_set_per_htlc(LDKHolderCommitmentTransaction *this_ptr, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val);
        public static native void HolderCommitmentTransaction_set_per_htlc(long this_ptr, long val);
        // MUST_USE_RES LDKHolderCommitmentTransaction HolderCommitmentTransaction_new_missing_holder_sig(LDKTransaction unsigned_tx, LDKSignature counterparty_sig, LDKPublicKey holder_funding_key, LDKPublicKey counterparty_funding_key, LDKTxCreationKeys keys, uint32_t feerate_per_kw, LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data);
-       public static native long HolderCommitmentTransaction_new_missing_holder_sig(long unsigned_tx, long counterparty_sig, byte[] holder_funding_key, byte[] counterparty_funding_key, long keys, int feerate_per_kw, long htlc_data);
+       public static native long HolderCommitmentTransaction_new_missing_holder_sig(long unsigned_tx, byte[] counterparty_sig, byte[] holder_funding_key, byte[] counterparty_funding_key, long keys, int feerate_per_kw, long htlc_data);
        // MUST_USE_RES LDKTxCreationKeys HolderCommitmentTransaction_trust_key_derivation(const LDKHolderCommitmentTransaction *this_arg);
        public static native long HolderCommitmentTransaction_trust_key_derivation(long this_arg);
        // MUST_USE_RES LDKThirtyTwoBytes HolderCommitmentTransaction_txid(const LDKHolderCommitmentTransaction *this_arg);
        public static native byte[] HolderCommitmentTransaction_txid(long this_arg);
        // MUST_USE_RES LDKSignature HolderCommitmentTransaction_get_holder_sig(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*funding_key)[32], LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
-       public static native long HolderCommitmentTransaction_get_holder_sig(long this_arg, byte[] funding_key, long funding_redeemscript, long channel_value_satoshis);
+       public static native byte[] HolderCommitmentTransaction_get_holder_sig(long this_arg, byte[] funding_key, long funding_redeemscript, long channel_value_satoshis);
        // MUST_USE_RES LDKCResult_CVec_SignatureZNoneZ HolderCommitmentTransaction_get_htlc_sigs(const LDKHolderCommitmentTransaction *this_arg, const uint8_t (*htlc_base_key)[32], uint16_t counterparty_selected_contest_delay);
        public static native long HolderCommitmentTransaction_get_htlc_sigs(long this_arg, byte[] htlc_base_key, short counterparty_selected_contest_delay);
        // LDKCVec_u8Z HolderCommitmentTransaction_write(const LDKHolderCommitmentTransaction *obj);