From 1854b5cebef22ace9e9e4dd191f609818df9ce08 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 5 Dec 2021 23:39:42 +0000 Subject: [PATCH] Update auto-updated Java files --- java_strings.py | 1 + .../java/org/ldk/enums/COption_NoneZ.java | 17 + .../java/org/ldk/enums/CreationError.java | 4 + src/main/java/org/ldk/enums/Level.java | 4 + src/main/java/org/ldk/impl/bindings.java | 376 ++- src/main/java/org/ldk/structs/APIError.java | 9 + .../java/org/ldk/structs/AcceptChannel.java | 47 + src/main/java/org/ldk/structs/Access.java | 4 + .../ldk/structs/AnnouncementSignatures.java | 21 + .../org/ldk/structs/BackgroundProcessor.java | 14 +- src/main/java/org/ldk/structs/Balance.java | 16 + src/main/java/org/ldk/structs/BaseSign.java | 39 + src/main/java/org/ldk/structs/BestBlock.java | 8 + .../org/ldk/structs/BroadcasterInterface.java | 3 + .../structs/BuiltCommitmentTransaction.java | 20 + .../java/org/ldk/structs/ChainMonitor.java | 18 + .../java/org/ldk/structs/ChainParameters.java | 11 + .../org/ldk/structs/ChannelAnnouncement.java | 25 + .../java/org/ldk/structs/ChannelConfig.java | 33 + .../org/ldk/structs/ChannelCounterparty.java | 19 + .../java/org/ldk/structs/ChannelDetails.java | 116 +- .../java/org/ldk/structs/ChannelFeatures.java | 12 + .../ldk/structs/ChannelHandshakeConfig.java | 15 + .../ldk/structs/ChannelHandshakeLimits.java | 35 + .../java/org/ldk/structs/ChannelInfo.java | 37 +- .../java/org/ldk/structs/ChannelManager.java | 216 +- .../ldk/structs/ChannelManagerPersister.java | 3 + .../ldk/structs/ChannelManagerReadArgs.java | 26 + .../ldk/structs/ChannelMessageHandler.java | 64 + .../java/org/ldk/structs/ChannelMonitor.java | 56 +- .../org/ldk/structs/ChannelMonitorUpdate.java | 8 + .../org/ldk/structs/ChannelPublicKeys.java | 25 + .../org/ldk/structs/ChannelReestablish.java | 14 + .../structs/ChannelTransactionParameters.java | 51 +- .../org/ldk/structs/ChannelTypeFeatures.java | 119 + .../java/org/ldk/structs/ChannelUpdate.java | 13 + .../java/org/ldk/structs/ClosingSigned.java | 21 + .../ldk/structs/ClosingSignedFeeRange.java | 13 + .../org/ldk/structs/ClosingTransaction.java | 19 + .../java/org/ldk/structs/ClosureReason.java | 28 + .../org/ldk/structs/CommitmentSigned.java | 16 + .../ldk/structs/CommitmentTransaction.java | 14 + .../org/ldk/structs/CommitmentUpdate.java | 27 + src/main/java/org/ldk/structs/Confirm.java | 11 + ...nterpartyChannelTransactionParameters.java | 13 + .../structs/CounterpartyForwardingInfo.java | 15 + .../org/ldk/structs/CustomMessageHandler.java | 5 + .../org/ldk/structs/CustomMessageReader.java | 4 + .../java/org/ldk/structs/DataLossProtect.java | 11 + .../java/org/ldk/structs/DecodeError.java | 3 + .../java/org/ldk/structs/DefaultRouter.java | 4 + .../DelayedPaymentOutputDescriptor.java | 32 + .../java/org/ldk/structs/Description.java | 15 + .../DirectedChannelTransactionParameters.java | 15 + .../ldk/structs/DirectionalChannelInfo.java | 33 + .../java/org/ldk/structs/ErrorAction.java | 30 + .../java/org/ldk/structs/ErrorMessage.java | 13 + .../ldk/structs/ErroringMessageHandler.java | 3 + src/main/java/org/ldk/structs/Event.java | 191 +- .../java/org/ldk/structs/EventHandler.java | 3 + .../java/org/ldk/structs/EventsProvider.java | 3 + src/main/java/org/ldk/structs/ExpiryTime.java | 17 + src/main/java/org/ldk/structs/Fallback.java | 17 + .../java/org/ldk/structs/FeeEstimator.java | 23 +- .../org/ldk/structs/FilesystemPersister.java | 6 + src/main/java/org/ldk/structs/Filter.java | 6 + .../java/org/ldk/structs/FundingCreated.java | 21 + .../java/org/ldk/structs/FundingLocked.java | 13 + .../java/org/ldk/structs/FundingSigned.java | 13 + .../ldk/structs/GossipTimestampFilter.java | 17 + .../ldk/structs/HTLCOutputInCommitment.java | 25 + src/main/java/org/ldk/structs/HTLCUpdate.java | 5 + .../structs/HolderCommitmentTransaction.java | 15 + .../ldk/structs/IgnoringMessageHandler.java | 5 + .../java/org/ldk/structs/InMemorySigner.java | 57 + src/main/java/org/ldk/structs/Init.java | 9 + .../java/org/ldk/structs/InitFeatures.java | 20 +- .../ldk/structs/InvalidShutdownScript.java | 7 + src/main/java/org/ldk/structs/Invoice.java | 27 + .../java/org/ldk/structs/InvoiceFeatures.java | 20 +- .../java/org/ldk/structs/InvoicePayer.java | 42 +- .../org/ldk/structs/InvoiceSignature.java | 9 + .../java/org/ldk/structs/KeysInterface.java | 34 + .../java/org/ldk/structs/KeysManager.java | 13 + .../java/org/ldk/structs/LightningError.java | 11 + src/main/java/org/ldk/structs/Listen.java | 7 + .../java/org/ldk/structs/LockableScore.java | 52 +- .../org/ldk/structs/LockedChannelMonitor.java | 1 + src/main/java/org/ldk/structs/Logger.java | 1 + .../java/org/ldk/structs/MessageHandler.java | 9 + .../org/ldk/structs/MessageSendEvent.java | 39 + .../structs/MessageSendEventsProvider.java | 2 + .../org/ldk/structs/MinFinalCltvExpiry.java | 17 + .../java/org/ldk/structs/MonitorEvent.java | 9 + .../org/ldk/structs/MonitorUpdateError.java | 62 - .../java/org/ldk/structs/MonitorUpdateId.java | 13 + .../structs/MultiThreadedLockableScore.java | 36 + src/main/java/org/ldk/structs/NetAddress.java | 33 +- .../org/ldk/structs/NetGraphMsgHandler.java | 9 + .../java/org/ldk/structs/NetworkGraph.java | 51 + .../java/org/ldk/structs/NetworkUpdate.java | 9 + .../org/ldk/structs/NodeAnnouncement.java | 13 + .../org/ldk/structs/NodeAnnouncementInfo.java | 28 + .../java/org/ldk/structs/NodeFeatures.java | 20 +- src/main/java/org/ldk/structs/NodeId.java | 11 + src/main/java/org/ldk/structs/NodeInfo.java | 16 + .../java/org/ldk/structs/OpenChannel.java | 89 + .../java/org/ldk/structs/Option_AccessZ.java | 2 + .../Option_C2Tuple_usizeTransactionZZ.java | 4 + .../ldk/structs/Option_CVec_NetAddressZZ.java | 4 + .../ldk/structs/Option_ClosureReasonZ.java | 4 + .../java/org/ldk/structs/Option_EventZ.java | 4 + .../java/org/ldk/structs/Option_FilterZ.java | 2 + .../org/ldk/structs/Option_MonitorEventZ.java | 4 + .../ldk/structs/Option_NetworkUpdateZ.java | 4 + .../java/org/ldk/structs/Option_TypeZ.java | 4 + .../java/org/ldk/structs/Option_u16Z.java | 4 + .../java/org/ldk/structs/Option_u32Z.java | 4 + .../java/org/ldk/structs/Option_u64Z.java | 4 + src/main/java/org/ldk/structs/OutPoint.java | 24 + src/main/java/org/ldk/structs/Payee.java | 33 + .../java/org/ldk/structs/PayeePubKey.java | 17 + src/main/java/org/ldk/structs/Payer.java | 50 + .../java/org/ldk/structs/PaymentError.java | 6 + .../java/org/ldk/structs/PaymentPurpose.java | 22 +- .../org/ldk/structs/PaymentSendFailure.java | 9 + .../java/org/ldk/structs/PeerHandleError.java | 7 + .../java/org/ldk/structs/PeerManager.java | 26 + src/main/java/org/ldk/structs/Persist.java | 10 + src/main/java/org/ldk/structs/Ping.java | 13 + src/main/java/org/ldk/structs/Pong.java | 9 + .../org/ldk/structs/PositiveTimestamp.java | 13 + .../java/org/ldk/structs/PrivateRoute.java | 15 + .../org/ldk/structs/QueryChannelRange.java | 18 + .../org/ldk/structs/QueryShortChannelIds.java | 12 + .../java/org/ldk/structs/RawDataPart.java | 12 + src/main/java/org/ldk/structs/RawInvoice.java | 24 + .../org/ldk/structs/ReadOnlyNetworkGraph.java | 3 + src/main/java/org/ldk/structs/Record.java | 18 + .../org/ldk/structs/ReplyChannelRange.java | 24 + .../ldk/structs/ReplyShortChannelIdsEnd.java | 13 + .../Result_AcceptChannelDecodeErrorZ.java | 6 + ...lt_AnnouncementSignaturesDecodeErrorZ.java | 6 + ...uiltCommitmentTransactionDecodeErrorZ.java | 6 + ..._BlockHashChannelManagerZDecodeErrorZ.java | 4 + ..._BlockHashChannelMonitorZDecodeErrorZ.java | 6 + ...mentHashPaymentIdZPaymentSendFailureZ.java | 6 + ...le_PaymentHashPaymentSecretZAPIErrorZ.java | 94 + ...2Tuple_PaymentHashPaymentSecretZNoneZ.java | 88 + ...2Tuple_SignatureCVec_SignatureZZNoneZ.java | 5 + ...lt_COption_ClosureReasonZDecodeErrorZ.java | 6 + .../Result_COption_EventZDecodeErrorZ.java | 6 + ...ult_COption_MonitorEventZDecodeErrorZ.java | 6 + ...lt_COption_NetworkUpdateZDecodeErrorZ.java | 6 + .../Result_COption_TypeZDecodeErrorZ.java | 6 + ...Tuple_BlockHashChannelMonitorZZErrorZ.java | 6 + .../structs/Result_CVec_CVec_u8ZZNoneZ.java | 5 + .../structs/Result_CVec_SignatureZNoneZ.java | 5 + .../Result_CVec_u8ZPeerHandleErrorZ.java | 6 + ...esult_ChannelAnnouncementDecodeErrorZ.java | 6 + .../Result_ChannelConfigDecodeErrorZ.java | 6 + .../Result_ChannelFeaturesDecodeErrorZ.java | 4 + .../Result_ChannelInfoDecodeErrorZ.java | 6 + ...sult_ChannelMonitorUpdateDecodeErrorZ.java | 6 + .../Result_ChannelPublicKeysDecodeErrorZ.java | 6 + ...Result_ChannelReestablishDecodeErrorZ.java | 6 + ...nnelTransactionParametersDecodeErrorZ.java | 6 + ...esult_ChannelTypeFeaturesDecodeErrorZ.java | 76 + .../Result_ChannelUpdateDecodeErrorZ.java | 6 + .../Result_ClosingSignedDecodeErrorZ.java | 6 + ...ult_ClosingSignedFeeRangeDecodeErrorZ.java | 6 + .../Result_CommitmentSignedDecodeErrorZ.java | 6 + ...ult_CommitmentTransactionDecodeErrorZ.java | 6 + ...nnelTransactionParametersDecodeErrorZ.java | 6 + ...edPaymentOutputDescriptorDecodeErrorZ.java | 6 + .../Result_DescriptionCreationErrorZ.java | 6 + ...lt_DirectionalChannelInfoDecodeErrorZ.java | 6 + .../Result_ErrorMessageDecodeErrorZ.java | 6 + .../Result_ExpiryTimeCreationErrorZ.java | 6 + .../Result_FundingCreatedDecodeErrorZ.java | 6 + .../Result_FundingLockedDecodeErrorZ.java | 6 + .../Result_FundingSignedDecodeErrorZ.java | 6 + ...ult_GossipTimestampFilterDecodeErrorZ.java | 6 + ...lt_HTLCOutputInCommitmentDecodeErrorZ.java | 6 + .../Result_HTLCUpdateDecodeErrorZ.java | 6 + ...lderCommitmentTransactionDecodeErrorZ.java | 6 + .../Result_InMemorySignerDecodeErrorZ.java | 6 + .../ldk/structs/Result_InitDecodeErrorZ.java | 6 + .../Result_InitFeaturesDecodeErrorZ.java | 4 + .../Result_InvoiceFeaturesDecodeErrorZ.java | 4 + .../org/ldk/structs/Result_InvoiceNoneZ.java | 5 + .../structs/Result_InvoiceSemanticErrorZ.java | 6 + .../Result_InvoiceSignOrCreationErrorZ.java | 6 + .../Result_LockedChannelMonitorNoneZ.java | 3 + .../Result_NetAddressDecodeErrorZ.java | 6 + .../Result_NetworkGraphDecodeErrorZ.java | 6 + .../Result_NodeAnnouncementDecodeErrorZ.java | 6 + ...sult_NodeAnnouncementInfoDecodeErrorZ.java | 6 + .../Result_NodeFeaturesDecodeErrorZ.java | 4 + .../structs/Result_NodeIdDecodeErrorZ.java | 6 + .../structs/Result_NodeInfoDecodeErrorZ.java | 6 + .../org/ldk/structs/Result_NoneAPIErrorZ.java | 5 + .../Result_NoneChannelMonitorUpdateErrZ.java | 5 + .../org/ldk/structs/Result_NoneErrorZ.java | 5 + .../structs/Result_NoneLightningErrorZ.java | 5 + .../Result_NoneMonitorUpdateErrorZ.java | 83 - .../org/ldk/structs/Result_NoneNoneZ.java | 4 + .../Result_NonePaymentSendFailureZ.java | 5 + .../structs/Result_NonePeerHandleErrorZ.java | 5 + .../structs/Result_NoneSemanticErrorZ.java | 5 + .../Result_OpenChannelDecodeErrorZ.java | 6 + .../structs/Result_OutPointDecodeErrorZ.java | 6 + .../ldk/structs/Result_PayeeDecodeErrorZ.java | 6 + .../ldk/structs/Result_PayeePubKeyErrorZ.java | 6 + .../Result_PaymentIdPaymentErrorZ.java | 6 + .../Result_PaymentIdPaymentSendFailureZ.java | 6 + .../Result_PaymentPreimageAPIErrorZ.java | 91 + .../Result_PaymentSecretAPIErrorZ.java | 6 + .../structs/Result_PaymentSecretNoneZ.java | 85 + .../ldk/structs/Result_PingDecodeErrorZ.java | 6 + .../ldk/structs/Result_PongDecodeErrorZ.java | 6 + ...esult_PositiveTimestampCreationErrorZ.java | 6 + .../Result_PrivateRouteCreationErrorZ.java | 6 + .../ldk/structs/Result_PublicKeyErrorZ.java | 6 + .../Result_QueryChannelRangeDecodeErrorZ.java | 6 + ...sult_QueryShortChannelIdsDecodeErrorZ.java | 6 + .../Result_RecoverableSignatureNoneZ.java | 5 + .../Result_ReplyChannelRangeDecodeErrorZ.java | 6 + ...t_ReplyShortChannelIdsEndDecodeErrorZ.java | 6 + .../Result_RevokeAndACKDecodeErrorZ.java | 6 + .../ldk/structs/Result_RouteDecodeErrorZ.java | 6 + .../structs/Result_RouteHintDecodeErrorZ.java | 6 + .../Result_RouteHintHopDecodeErrorZ.java | 6 + .../structs/Result_RouteHopDecodeErrorZ.java | 6 + .../structs/Result_RouteLightningErrorZ.java | 6 + .../Result_RouteParametersDecodeErrorZ.java | 6 + .../Result_RoutingFeesDecodeErrorZ.java | 6 + .../structs/Result_ScorerDecodeErrorZ.java | 4 + .../Result_ScoringParametersDecodeErrorZ.java | 12 +- .../ldk/structs/Result_SecretKeyErrorZ.java | 4 + .../structs/Result_ShutdownDecodeErrorZ.java | 6 + .../Result_ShutdownScriptDecodeErrorZ.java | 6 + ..._ShutdownScriptInvalidShutdownScriptZ.java | 6 + .../org/ldk/structs/Result_SiPrefixNoneZ.java | 5 + .../ldk/structs/Result_SignDecodeErrorZ.java | 6 + .../ldk/structs/Result_SignatureNoneZ.java | 5 + .../structs/Result_SignedRawInvoiceNoneZ.java | 5 + ...SpendableOutputDescriptorDecodeErrorZ.java | 6 + ...icPaymentOutputDescriptorDecodeErrorZ.java | 6 + .../org/ldk/structs/Result_StringErrorZ.java | 4 + .../ldk/structs/Result_TransactionNoneZ.java | 5 + ...Result_TrustedClosingTransactionNoneZ.java | 3 + ...ult_TrustedCommitmentTransactionNoneZ.java | 3 + .../Result_TxCreationKeysDecodeErrorZ.java | 6 + .../structs/Result_TxCreationKeysErrorZ.java | 6 + .../ldk/structs/Result_TxOutAccessErrorZ.java | 6 + ...signedChannelAnnouncementDecodeErrorZ.java | 6 + ...ult_UnsignedChannelUpdateDecodeErrorZ.java | 6 + ..._UnsignedNodeAnnouncementDecodeErrorZ.java | 6 + .../Result_UpdateAddHTLCDecodeErrorZ.java | 6 + .../Result_UpdateFailHTLCDecodeErrorZ.java | 6 + ...t_UpdateFailMalformedHTLCDecodeErrorZ.java | 6 + .../structs/Result_UpdateFeeDecodeErrorZ.java | 6 + .../Result_UpdateFulfillHTLCDecodeErrorZ.java | 6 + .../ldk/structs/Result__u832APIErrorZ.java | 6 + .../structs/Result_boolLightningErrorZ.java | 6 + .../structs/Result_boolPeerHandleErrorZ.java | 6 + .../java/org/ldk/structs/RetryAttempts.java | 17 + .../java/org/ldk/structs/RevokeAndACK.java | 17 + src/main/java/org/ldk/structs/Route.java | 25 + src/main/java/org/ldk/structs/RouteHint.java | 19 + .../java/org/ldk/structs/RouteHintHop.java | 39 + src/main/java/org/ldk/structs/RouteHop.java | 39 + .../java/org/ldk/structs/RouteParameters.java | 17 + src/main/java/org/ldk/structs/Router.java | 17 +- .../java/org/ldk/structs/RoutingFees.java | 23 + .../ldk/structs/RoutingMessageHandler.java | 28 + src/main/java/org/ldk/structs/Score.java | 74 +- src/main/java/org/ldk/structs/Scorer.java | 17 +- .../org/ldk/structs/ScoringParameters.java | 103 +- src/main/java/org/ldk/structs/Sha256.java | 13 + src/main/java/org/ldk/structs/Shutdown.java | 13 + .../java/org/ldk/structs/ShutdownScript.java | 13 + src/main/java/org/ldk/structs/Sign.java | 4 + .../org/ldk/structs/SignOrCreationError.java | 11 + .../org/ldk/structs/SignedRawInvoice.java | 17 + .../org/ldk/structs/SocketDescriptor.java | 11 + .../structs/SpendableOutputDescriptor.java | 9 + .../StaticPaymentOutputDescriptor.java | 20 + ...nouncementChannelUpdateChannelUpdateZ.java | 9 + ...uple_RawInvoice_u832InvoiceSignatureZ.java | 9 + .../structs/TrustedClosingTransaction.java | 9 + .../structs/TrustedCommitmentTransaction.java | 16 + .../TwoTuple_BlockHashChannelManagerZ.java | 11 + .../TwoTuple_BlockHashChannelMonitorZ.java | 7 + .../ldk/structs/TwoTuple_OutPointScriptZ.java | 7 + .../TwoTuple_PaymentHashPaymentIdZ.java | 7 + .../TwoTuple_PaymentHashPaymentSecretZ.java | 7 + .../ldk/structs/TwoTuple_PublicKeyTypeZ.java | 7 + .../TwoTuple_SignatureCVec_SignatureZZ.java | 7 + ...woTuple_TxidCVec_C2Tuple_u32ScriptZZZ.java | 7 + ...TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.java | 7 + .../org/ldk/structs/TwoTuple_u32ScriptZ.java | 7 + .../org/ldk/structs/TwoTuple_u32TxOutZ.java | 7 + .../structs/TwoTuple_usizeTransactionZ.java | 7 + .../java/org/ldk/structs/TxCreationKeys.java | 33 + src/main/java/org/ldk/structs/TxOut.java | 1 + src/main/java/org/ldk/structs/Type.java | 6 + .../structs/UnsignedChannelAnnouncement.java | 26 + .../ldk/structs/UnsignedChannelUpdate.java | 29 + .../ldk/structs/UnsignedNodeAnnouncement.java | 22 + .../java/org/ldk/structs/UpdateAddHTLC.java | 20 + .../java/org/ldk/structs/UpdateFailHTLC.java | 11 + .../ldk/structs/UpdateFailMalformedHTLC.java | 14 + src/main/java/org/ldk/structs/UpdateFee.java | 13 + .../org/ldk/structs/UpdateFulfillHTLC.java | 17 + src/main/java/org/ldk/structs/UserConfig.java | 44 +- .../java/org/ldk/structs/UtilMethods.java | 124 +- src/main/java/org/ldk/structs/Watch.java | 8 + .../java/org/ldk/structs/WatchedOutput.java | 19 + src/main/jni/bindings.c | 2298 ++++++++++++----- src/main/jni/bindings.c.body | 2298 ++++++++++++----- src/main/jni/org_ldk_enums_COption_NoneZ.h | 21 + src/main/jni/org_ldk_impl_bindings.h | 1208 ++++++--- ..._impl_bindings_LDKCOption_ClosureReasonZ.h | 21 + .../org_ldk_impl_bindings_LDKCOption_EventZ.h | 21 + ...k_impl_bindings_LDKCOption_MonitorEventZ.h | 21 + ts/bindings.c | 1631 +++++++++--- ts/bindings.c.body | 1631 +++++++++--- ts/bindings.ts | 1109 +++++--- ts/enums/COption_NoneZ.ts | 12 + ts/enums/CreationError.ts | 4 + ts/enums/Level.ts | 4 + ts/structs/ChannelDetails.ts | 13 +- ts/structs/ChannelInfo.ts | 7 - ts/structs/ChannelManager.ts | 33 +- ts/structs/ChannelMonitor.ts | 4 +- ts/structs/ChannelTransactionParameters.ts | 13 +- ts/structs/ChannelTypeFeatures.ts | 69 + ts/structs/ClosureReason.ts | 15 + .../DirectedChannelTransactionParameters.ts | 5 + ts/structs/ErrorAction.ts | 15 + ts/structs/Event.ts | 48 + ts/structs/InMemorySigner.ts | 5 + ts/structs/InitFeatures.ts | 5 - ts/structs/InvoiceFeatures.ts | 5 - ts/structs/InvoicePayer.ts | 8 +- ts/structs/KeysInterface.ts | 12 + ts/structs/LockableScore.ts | 61 +- ts/structs/MonitorUpdateError.ts | 49 - ts/structs/MultiThreadedLockableScore.ts | 29 + ts/structs/NetAddress.ts | 10 +- ts/structs/NetworkGraph.ts | 4 + ts/structs/NodeFeatures.ts | 5 - ts/structs/OpenChannel.ts | 11 + ts/structs/Payer.ts | 24 + ts/structs/PaymentPurpose.ts | 6 +- ...uple_PaymentHashPaymentSecretZAPIErrorZ.ts | 68 + ..._C2Tuple_PaymentHashPaymentSecretZNoneZ.ts | 63 + .../Result_ChannelTypeFeaturesDecodeErrorZ.ts | 57 + ts/structs/Result_NoneMonitorUpdateErrorZ.ts | 63 - ts/structs/Result_PaymentPreimageAPIErrorZ.ts | 65 + ts/structs/Result_PaymentSecretNoneZ.ts | 60 + .../Result_ScoringParametersDecodeErrorZ.ts | 4 +- ts/structs/Router.ts | 10 +- ts/structs/Score.ts | 28 +- ts/structs/Scorer.ts | 4 +- ts/structs/ScoringParameters.ts | 22 +- ts/structs/TrustedCommitmentTransaction.ts | 5 + ts/structs/UserConfig.ts | 13 +- ts/structs/UtilMethods.ts | 33 +- 371 files changed, 13519 insertions(+), 3397 deletions(-) create mode 100644 src/main/java/org/ldk/enums/COption_NoneZ.java create mode 100644 src/main/java/org/ldk/structs/ChannelTypeFeatures.java delete mode 100644 src/main/java/org/ldk/structs/MonitorUpdateError.java create mode 100644 src/main/java/org/ldk/structs/MultiThreadedLockableScore.java create mode 100644 src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java create mode 100644 src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.java create mode 100644 src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java delete mode 100644 src/main/java/org/ldk/structs/Result_NoneMonitorUpdateErrorZ.java create mode 100644 src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java create mode 100644 src/main/java/org/ldk/structs/Result_PaymentSecretNoneZ.java create mode 100644 src/main/jni/org_ldk_enums_COption_NoneZ.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_ClosureReasonZ.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_EventZ.h create mode 100644 src/main/jni/org_ldk_impl_bindings_LDKCOption_MonitorEventZ.h create mode 100644 ts/enums/COption_NoneZ.ts create mode 100644 ts/structs/ChannelTypeFeatures.ts delete mode 100644 ts/structs/MonitorUpdateError.ts create mode 100644 ts/structs/MultiThreadedLockableScore.ts create mode 100644 ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.ts create mode 100644 ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.ts create mode 100644 ts/structs/Result_ChannelTypeFeaturesDecodeErrorZ.ts delete mode 100644 ts/structs/Result_NoneMonitorUpdateErrorZ.ts create mode 100644 ts/structs/Result_PaymentPreimageAPIErrorZ.ts create mode 100644 ts/structs/Result_PaymentSecretNoneZ.ts diff --git a/java_strings.py b/java_strings.py index 3a72a5b8..78bd10a0 100644 --- a/java_strings.py +++ b/java_strings.py @@ -106,6 +106,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class UtilMethods { diff --git a/src/main/java/org/ldk/enums/COption_NoneZ.java b/src/main/java/org/ldk/enums/COption_NoneZ.java new file mode 100644 index 00000000..d4379d79 --- /dev/null +++ b/src/main/java/org/ldk/enums/COption_NoneZ.java @@ -0,0 +1,17 @@ +package org.ldk.enums; + +/** + * An enum which can either contain a or not + */ +public enum COption_NoneZ { + /** + * When we're in this state, this COption_NoneZ contains a + */ + LDKCOption_NoneZ_Some, + /** + * When we're in this state, this COption_NoneZ contains nothing + */ + LDKCOption_NoneZ_None, + ; static native void init(); + static { init(); } +} \ No newline at end of file diff --git a/src/main/java/org/ldk/enums/CreationError.java b/src/main/java/org/ldk/enums/CreationError.java index f46601b3..97b8d941 100644 --- a/src/main/java/org/ldk/enums/CreationError.java +++ b/src/main/java/org/ldk/enums/CreationError.java @@ -20,6 +20,10 @@ public enum CreationError { * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp` */ LDKCreationError_ExpiryTimeOutOfBounds, + /** + * The supplied millisatoshi amount was greater than the total bitcoin supply. + */ + LDKCreationError_InvalidAmount, ; static native void init(); static { init(); } } \ No newline at end of file diff --git a/src/main/java/org/ldk/enums/Level.java b/src/main/java/org/ldk/enums/Level.java index f278da87..6b065961 100644 --- a/src/main/java/org/ldk/enums/Level.java +++ b/src/main/java/org/ldk/enums/Level.java @@ -4,6 +4,10 @@ package org.ldk.enums; * An enum representing the available verbosity levels of the logger. */ public enum Level { + /** + * Designates extremely verbose information, including gossip-induced messages + */ + LDKLevel_Gossip, /** * Designates very low priority, often extremely verbose, information */ diff --git a/src/main/java/org/ldk/impl/bindings.java b/src/main/java/org/ldk/impl/bindings.java index 5e797304..3e4ac757 100644 --- a/src/main/java/org/ldk/impl/bindings.java +++ b/src/main/java/org/ldk/impl/bindings.java @@ -67,6 +67,7 @@ public class bindings { public static native long new_empty_slice_vec(); static { AccessError.values(); /* Force enum statics to run */ } + static { COption_NoneZ.values(); /* Force enum statics to run */ } static { ChannelMonitorUpdateErr.values(); /* Force enum statics to run */ } static { ConfirmationTarget.values(); /* Force enum statics to run */ } static { CreationError.values(); /* Force enum statics to run */ } @@ -214,6 +215,9 @@ public class bindings { public final static class CommitmentTxConfirmed extends LDKClosureReason { CommitmentTxConfirmed() { } } + public final static class FundingTimedOut extends LDKClosureReason { + FundingTimedOut() { } + } public final static class ProcessingError extends LDKClosureReason { public String err; ProcessingError(String err) { this.err = err; } @@ -300,8 +304,7 @@ public class bindings { public final static class InvoicePayment extends LDKPaymentPurpose { public byte[] payment_preimage; public byte[] payment_secret; - public long user_payment_id; - InvoicePayment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id) { this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; this.user_payment_id = user_payment_id; } + InvoicePayment(byte[] payment_preimage, byte[] payment_secret) { this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; } } public final static class SpontaneousPayment extends LDKPaymentPurpose { public byte[] spontaneous_payment; @@ -344,6 +347,11 @@ public class bindings { public long retry; PaymentPathFailed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path, long short_channel_id, long retry) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; this.short_channel_id = short_channel_id; this.retry = retry; } } + public final static class PaymentFailed extends LDKEvent { + public byte[] payment_id; + public byte[] payment_hash; + PaymentFailed(byte[] payment_id, byte[] payment_hash) { this.payment_id = payment_id; this.payment_hash = payment_hash; } + } public final static class PendingHTLCsForwardable extends LDKEvent { public long time_forwardable; PendingHTLCsForwardable(long time_forwardable) { this.time_forwardable = time_forwardable; } @@ -368,6 +376,12 @@ public class bindings { public byte[] transaction; DiscardFunding(byte[] channel_id, byte[] transaction) { this.channel_id = channel_id; this.transaction = transaction; } } + public final static class PaymentPathSuccessful extends LDKEvent { + public byte[] payment_id; + public byte[] payment_hash; + public long[] path; + PaymentPathSuccessful(byte[] payment_id, byte[] payment_hash, long[] path) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.path = path; } + } static native void init(); } static { LDKEvent.init(); } @@ -400,6 +414,9 @@ public class bindings { public Level ignore_and_log; IgnoreAndLog(Level ignore_and_log) { this.ignore_and_log = ignore_and_log; } } + public final static class IgnoreDuplicateGossip extends LDKErrorAction { + IgnoreDuplicateGossip() { } + } public final static class SendErrorMessage extends LDKErrorAction { public long msg; SendErrorMessage(long msg) { this.msg = msg; } @@ -507,18 +524,20 @@ public class bindings { } static { LDKMessageSendEvent.init(); } public static native LDKMessageSendEvent LDKMessageSendEvent_ref_from_ptr(long ptr); + public static native long LDKCResult_ScoringParametersDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_ScoringParametersDecodeErrorZ_get_err(long arg); + public static native long LDKCResult_ScorerDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_ScorerDecodeErrorZ_get_err(long arg); public static native long LDKCResult_InitFeaturesDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_InitFeaturesDecodeErrorZ_get_err(long arg); - public static native long LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(long arg); - public static native long LDKCResult_NodeFeaturesDecodeErrorZ_get_err(long arg); public static native long LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(long arg); + public static native long LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_NodeFeaturesDecodeErrorZ_get_err(long arg); public static native long LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(long arg); - public static native long LDKCResult_ScoringParametersDecodeErrorZ_get_ok(long arg); - public static native long LDKCResult_ScoringParametersDecodeErrorZ_get_err(long arg); - public static native long LDKCResult_ScorerDecodeErrorZ_get_ok(long arg); - public static native long LDKCResult_ScorerDecodeErrorZ_get_err(long arg); + public static native long LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(long arg); + public static native long LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(long arg); public static native long LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(long arg); public static native long LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(long arg); @@ -696,9 +715,8 @@ public class bindings { IPv6(byte[] addr, short port) { this.addr = addr; this.port = port; } } public final static class OnionV2 extends LDKNetAddress { - public byte[] addr; - public short port; - OnionV2(byte[] addr, short port) { this.addr = addr; this.port = port; } + public byte[] onion_v2; + OnionV2(byte[] onion_v2) { this.onion_v2 = onion_v2; } } public final static class OnionV3 extends LDKNetAddress { public byte[] ed25519_pubkey; @@ -715,8 +733,16 @@ public class bindings { public static native byte[] C2Tuple_PaymentHashPaymentSecretZ_get_a(long tuple); // struct LDKThirtyTwoBytes C2Tuple_PaymentHashPaymentSecretZ_get_b(LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR tuple); public static native byte[] C2Tuple_PaymentHashPaymentSecretZ_get_b(long tuple); + public static native long LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(long arg); + public static native void LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(long arg); + public static native long LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(long arg); + public static native long LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(long arg); + public static native byte[] LDKCResult_PaymentSecretNoneZ_get_ok(long arg); + public static native void LDKCResult_PaymentSecretNoneZ_get_err(long arg); public static native byte[] LDKCResult_PaymentSecretAPIErrorZ_get_ok(long arg); public static native long LDKCResult_PaymentSecretAPIErrorZ_get_err(long arg); + public static native byte[] LDKCResult_PaymentPreimageAPIErrorZ_get_ok(long arg); + public static native long LDKCResult_PaymentPreimageAPIErrorZ_get_err(long arg); public interface LDKWatch { long watch_channel(long funding_txo, long monitor); long update_channel(long funding_txo, long update); @@ -743,6 +769,7 @@ public class bindings { byte[] get_secure_random_bytes(); long read_chan_signer(byte[] reader); long sign_invoice(byte[] invoice_preimage); + byte[] get_inbound_payment_key_material(); } public static native long LDKKeysInterface_new(LDKKeysInterface impl); // LDKSecretKey KeysInterface_get_node_secret LDKKeysInterface *NONNULL_PTR this_arg @@ -759,6 +786,8 @@ public class bindings { public static native long KeysInterface_read_chan_signer(long this_arg, byte[] reader); // LDKCResult_RecoverableSignatureNoneZ KeysInterface_sign_invoice LDKKeysInterface *NONNULL_PTR this_arg, struct LDKCVec_u8Z invoice_preimage public static native long KeysInterface_sign_invoice(long this_arg, byte[] invoice_preimage); + // LDKThirtyTwoBytes KeysInterface_get_inbound_payment_key_material LDKKeysInterface *NONNULL_PTR this_arg + public static native byte[] KeysInterface_get_inbound_payment_key_material(long this_arg); public interface LDKFeeEstimator { int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target); } @@ -873,8 +902,6 @@ public class bindings { public static native long LDKCResult_COption_MonitorEventZDecodeErrorZ_get_err(long arg); public static native long LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(long arg); public static native long LDKCResult_HTLCUpdateDecodeErrorZ_get_err(long arg); - public static native void LDKCResult_NoneMonitorUpdateErrorZ_get_ok(long arg); - public static native long LDKCResult_NoneMonitorUpdateErrorZ_get_err(long arg); // struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple); public static native long C2Tuple_OutPointScriptZ_get_a(long tuple); // struct LDKCVec_u8Z C2Tuple_OutPointScriptZ_get_b(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple); @@ -1274,17 +1301,26 @@ public class bindings { // uint64_t SocketDescriptor_hash LDKSocketDescriptor *NONNULL_PTR this_arg public static native long SocketDescriptor_hash(long this_arg); public interface LDKScore { - long channel_penalty_msat(long short_channel_id, long source, long target); + long channel_penalty_msat(long short_channel_id, long send_amt_msat, long channel_capacity_msat, long source, long target); void payment_path_failed(long[] path, long short_channel_id); + void payment_path_successful(long[] path); byte[] write(); } public static native long LDKScore_new(LDKScore impl); - // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target - public static native long Score_channel_penalty_msat(long this_arg, long short_channel_id, long source, long target); + // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target + public static native long Score_channel_penalty_msat(long this_arg, long short_channel_id, long send_amt_msat, long channel_capacity_msat, long source, long target); // void Score_payment_path_failed LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id public static native void Score_payment_path_failed(long this_arg, long[] path, long short_channel_id); + // void Score_payment_path_successful LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path + public static native void Score_payment_path_successful(long this_arg, long[] path); // LDKCVec_u8Z Score_write LDKScore *NONNULL_PTR this_arg public static native byte[] Score_write(long this_arg); + public interface LDKLockableScore { + long lock(); + } + public static native long LDKLockableScore_new(LDKLockableScore impl); + // LDKScore LockableScore_lock LDKLockableScore *NONNULL_PTR this_arg + public static native long LockableScore_lock(long this_arg); public interface LDKChannelManagerPersister { long persist_manager(long channel_manager); } @@ -1314,7 +1350,9 @@ public class bindings { byte[] node_id(); long[] first_hops(); long send_payment(long route, byte[] payment_hash, byte[] payment_secret); + long send_spontaneous_payment(long route, byte[] payment_preimage); long retry_payment(long route, byte[] payment_id); + void abandon_payment(byte[] payment_id); } public static native long LDKPayer_new(LDKPayer impl); // LDKPublicKey Payer_node_id LDKPayer *NONNULL_PTR this_arg @@ -1323,14 +1361,18 @@ public class bindings { public static native long[] Payer_first_hops(long this_arg); // LDKCResult_PaymentIdPaymentSendFailureZ Payer_send_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret public static native long Payer_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret); + // LDKCResult_PaymentIdPaymentSendFailureZ Payer_send_spontaneous_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage + public static native long Payer_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage); // LDKCResult_NonePaymentSendFailureZ Payer_retry_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id public static native long Payer_retry_payment(long this_arg, long route, byte[] payment_id); + // void Payer_abandon_payment LDKPayer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id + public static native void Payer_abandon_payment(long this_arg, byte[] payment_id); public interface LDKRouter { - long find_route(byte[] payer, long params, long[] first_hops, long scorer); + long find_route(byte[] payer, long params, byte[] payment_hash, long[] first_hops, long scorer); } public static native long LDKRouter_new(LDKRouter impl); - // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer - public static native long Router_find_route(long this_arg, byte[] payer, long params, long[] first_hops, long scorer); + // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer + public static native long Router_find_route(long this_arg, byte[] payer, long params, byte[] payment_hash, long[] first_hops, long scorer); // struct LDKStr _ldk_get_compiled_version(void); public static native String _ldk_get_compiled_version(); // struct LDKStr _ldk_c_bindings_get_compiled_version(void); @@ -1425,6 +1467,12 @@ public class bindings { public static native long CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(long orig); + // enum LDKCOption_NoneZ COption_NoneZ_some(void); + public static native COption_NoneZ COption_NoneZ_some(); + // enum LDKCOption_NoneZ COption_NoneZ_none(void); + public static native COption_NoneZ COption_NoneZ_none(); + // void COption_NoneZ_free(enum LDKCOption_NoneZ _res); + public static native void COption_NoneZ_free(COption_NoneZ _res); // struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); public static native long CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(long o); // struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); @@ -1761,6 +1809,22 @@ public class bindings { public static native long CResult_COption_EventZDecodeErrorZ_clone(long orig); // void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); public static native void CVec_MessageSendEventZ_free(long[] _res); + // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); + public static native long CResult_ScoringParametersDecodeErrorZ_ok(long o); + // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ScoringParametersDecodeErrorZ_err(long e); + // bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ScoringParametersDecodeErrorZ_is_ok(long o); + // void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); + public static native void CResult_ScoringParametersDecodeErrorZ_free(long _res); + // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); + public static native long CResult_ScorerDecodeErrorZ_ok(long o); + // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ScorerDecodeErrorZ_err(long e); + // bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ScorerDecodeErrorZ_is_ok(long o); + // void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); + public static native void CResult_ScorerDecodeErrorZ_free(long _res); // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); public static native long CResult_InitFeaturesDecodeErrorZ_ok(long o); // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); @@ -1769,14 +1833,6 @@ public class bindings { public static native boolean CResult_InitFeaturesDecodeErrorZ_is_ok(long o); // void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); public static native void CResult_InitFeaturesDecodeErrorZ_free(long _res); - // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); - public static native long CResult_NodeFeaturesDecodeErrorZ_ok(long o); - // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_NodeFeaturesDecodeErrorZ_err(long e); - // bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_NodeFeaturesDecodeErrorZ_is_ok(long o); - // void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); - public static native void CResult_NodeFeaturesDecodeErrorZ_free(long _res); // struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); public static native long CResult_ChannelFeaturesDecodeErrorZ_ok(long o); // struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); @@ -1785,6 +1841,14 @@ public class bindings { public static native boolean CResult_ChannelFeaturesDecodeErrorZ_is_ok(long o); // void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); public static native void CResult_ChannelFeaturesDecodeErrorZ_free(long _res); + // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); + public static native long CResult_NodeFeaturesDecodeErrorZ_ok(long o); + // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_NodeFeaturesDecodeErrorZ_err(long e); + // bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_NodeFeaturesDecodeErrorZ_is_ok(long o); + // void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); + public static native void CResult_NodeFeaturesDecodeErrorZ_free(long _res); // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); public static native long CResult_InvoiceFeaturesDecodeErrorZ_ok(long o); // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); @@ -1793,22 +1857,14 @@ public class bindings { public static native boolean CResult_InvoiceFeaturesDecodeErrorZ_is_ok(long o); // void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); public static native void CResult_InvoiceFeaturesDecodeErrorZ_free(long _res); - // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); - public static native long CResult_ScoringParametersDecodeErrorZ_ok(long o); - // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_ScoringParametersDecodeErrorZ_err(long e); - // bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_ScoringParametersDecodeErrorZ_is_ok(long o); - // void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); - public static native void CResult_ScoringParametersDecodeErrorZ_free(long _res); - // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); - public static native long CResult_ScorerDecodeErrorZ_ok(long o); - // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); - public static native long CResult_ScorerDecodeErrorZ_err(long e); - // bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); - public static native boolean CResult_ScorerDecodeErrorZ_is_ok(long o); - // void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); - public static native void CResult_ScorerDecodeErrorZ_free(long _res); + // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); + public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_ok(long o); + // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + public static native long CResult_ChannelTypeFeaturesDecodeErrorZ_err(long e); + // bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); + public static native boolean CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(long o); + // void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); + public static native void CResult_ChannelTypeFeaturesDecodeErrorZ_free(long _res); // struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); public static native long CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(long o); // struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); @@ -2069,6 +2125,42 @@ public class bindings { public static native long C2Tuple_PaymentHashPaymentSecretZ_new(byte[] a, byte[] b); // void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); public static native void C2Tuple_PaymentHashPaymentSecretZ_free(long _res); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(long o); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + // bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); + public static native boolean CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(long o); + // void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); + public static native void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(long _res); + // uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(long arg); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(long orig); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(long o); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(long e); + // bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); + public static native boolean CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(long o); + // void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); + public static native void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(long _res); + // uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(long arg); + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); + public static native long CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(long orig); + // struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); + public static native long CResult_PaymentSecretNoneZ_ok(byte[] o); + // struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); + public static native long CResult_PaymentSecretNoneZ_err(); + // bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); + public static native boolean CResult_PaymentSecretNoneZ_is_ok(long o); + // void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); + public static native void CResult_PaymentSecretNoneZ_free(long _res); + // uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg); + public static native long CResult_PaymentSecretNoneZ_clone_ptr(long arg); + // struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); + public static native long CResult_PaymentSecretNoneZ_clone(long orig); // struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); public static native long CResult_PaymentSecretAPIErrorZ_ok(byte[] o); // struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); @@ -2081,6 +2173,18 @@ public class bindings { public static native long CResult_PaymentSecretAPIErrorZ_clone_ptr(long arg); // struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); public static native long CResult_PaymentSecretAPIErrorZ_clone(long orig); + // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); + public static native long CResult_PaymentPreimageAPIErrorZ_ok(byte[] o); + // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); + public static native long CResult_PaymentPreimageAPIErrorZ_err(long e); + // bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); + public static native boolean CResult_PaymentPreimageAPIErrorZ_is_ok(long o); + // void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); + public static native void CResult_PaymentPreimageAPIErrorZ_free(long _res); + // uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg); + public static native long CResult_PaymentPreimageAPIErrorZ_clone_ptr(long arg); + // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); + public static native long CResult_PaymentPreimageAPIErrorZ_clone(long orig); // void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); public static native void CVec_ChannelMonitorZ_free(long[] _res); // struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); @@ -2337,18 +2441,6 @@ public class bindings { public static native long CResult_HTLCUpdateDecodeErrorZ_clone_ptr(long arg); // struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); public static native long CResult_HTLCUpdateDecodeErrorZ_clone(long orig); - // struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); - public static native long CResult_NoneMonitorUpdateErrorZ_ok(); - // struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e); - public static native long CResult_NoneMonitorUpdateErrorZ_err(long e); - // bool CResult_NoneMonitorUpdateErrorZ_is_ok(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR o); - public static native boolean CResult_NoneMonitorUpdateErrorZ_is_ok(long o); - // void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res); - public static native void CResult_NoneMonitorUpdateErrorZ_free(long _res); - // uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg); - public static native long CResult_NoneMonitorUpdateErrorZ_clone_ptr(long arg); - // struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig); - public static native long CResult_NoneMonitorUpdateErrorZ_clone(long orig); // uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg); public static native long C2Tuple_OutPointScriptZ_clone_ptr(long arg); // struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); @@ -3051,8 +3143,8 @@ public class bindings { public static native long PaymentPurpose_clone_ptr(long arg); // struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); public static native long PaymentPurpose_clone(long orig); - // struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id); - public static native long PaymentPurpose_invoice_payment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id); + // struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret); + public static native long PaymentPurpose_invoice_payment(byte[] payment_preimage, byte[] payment_secret); // struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); public static native long PaymentPurpose_spontaneous_payment(byte[] a); // void ClosureReason_free(struct LDKClosureReason this_ptr); @@ -3069,6 +3161,8 @@ public class bindings { public static native long ClosureReason_cooperative_closure(); // struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); public static native long ClosureReason_commitment_tx_confirmed(); + // struct LDKClosureReason ClosureReason_funding_timed_out(void); + public static native long ClosureReason_funding_timed_out(); // struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); public static native long ClosureReason_processing_error(String err); // struct LDKClosureReason ClosureReason_disconnected_peer(void); @@ -3093,6 +3187,8 @@ public class bindings { public static native long Event_payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, long fee_paid_msat); // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); public static native long Event_payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path, long short_channel_id, long retry); + // struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); + public static native long Event_payment_failed(byte[] payment_id, byte[] payment_hash); // struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); public static native long Event_pending_htlcs_forwardable(long time_forwardable); // struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs); @@ -3103,6 +3199,8 @@ public class bindings { public static native long Event_channel_closed(byte[] channel_id, long user_channel_id, long reason); // struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); public static native long Event_discard_funding(byte[] channel_id, byte[] transaction); + // struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); + public static native long Event_payment_path_successful(byte[] payment_id, byte[] payment_hash, long[] path); // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); public static native byte[] Event_write(long obj); // struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); @@ -3183,6 +3281,8 @@ public class bindings { public static native boolean verify(byte[] msg, String sig, byte[] pk); // enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); public static native Level Level_clone(long orig); + // enum LDKLevel Level_gossip(void); + public static native Level Level_gossip(); // enum LDKLevel Level_trace(void); public static native Level Level_trace(); // enum LDKLevel Level_debug(void); @@ -3351,8 +3451,12 @@ public class bindings { public static native boolean UserConfig_get_accept_forwards_to_priv_channels(long this_ptr); // void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); public static native void UserConfig_set_accept_forwards_to_priv_channels(long this_ptr, boolean val); - // MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg); - public static native long UserConfig_new(long own_channel_config_arg, long peer_channel_config_limits_arg, long channel_options_arg, boolean accept_forwards_to_priv_channels_arg); + // bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); + public static native boolean UserConfig_get_accept_inbound_channels(long this_ptr); + // void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); + public static native void UserConfig_set_accept_inbound_channels(long this_ptr, boolean val); + // MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg); + public static native long UserConfig_new(long own_channel_config_arg, long peer_channel_config_limits_arg, long channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg); // uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg); public static native long UserConfig_clone_ptr(long arg); // struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); @@ -3479,18 +3583,6 @@ public class bindings { public static native byte[] ChannelMonitorUpdate_write(long obj); // struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); public static native long ChannelMonitorUpdate_read(byte[] ser); - // void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj); - public static native void MonitorUpdateError_free(long this_obj); - // struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr); - public static native String MonitorUpdateError_get_a(long this_ptr); - // void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val); - public static native void MonitorUpdateError_set_a(long this_ptr, String val); - // MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg); - public static native long MonitorUpdateError_new(String a_arg); - // uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg); - public static native long MonitorUpdateError_clone_ptr(long arg); - // struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); - public static native long MonitorUpdateError_clone(long orig); // void MonitorEvent_free(struct LDKMonitorEvent this_ptr); public static native void MonitorEvent_free(long this_ptr); // uint64_t MonitorEvent_clone_ptr(LDKMonitorEvent *NONNULL_PTR arg); @@ -3543,7 +3635,7 @@ public class bindings { public static native long ChannelMonitor_clone(long orig); // struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); public static native byte[] ChannelMonitor_write(long obj); - // MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); + // MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); public static native long ChannelMonitor_update_monitor(long this_arg, long updates, long broadcaster, long fee_estimator, long logger); // MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); public static native long ChannelMonitor_get_latest_update_id(long this_arg); @@ -3737,6 +3829,8 @@ public class bindings { public static native long InMemorySigner_funding_outpoint(long this_arg); // MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); public static native long InMemorySigner_get_channel_parameters(long this_arg); + // MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + public static native boolean InMemorySigner_opt_anchors(long this_arg); // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); public static native long InMemorySigner_sign_counterparty_payment_input(long this_arg, byte[] spend_tx, long input_idx, long descriptor); // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); @@ -3851,6 +3945,10 @@ public class bindings { public static native long ChannelDetails_get_user_channel_id(long this_ptr); // void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); public static native void ChannelDetails_set_user_channel_id(long this_ptr, long val); + // uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + public static native long ChannelDetails_get_balance_msat(long this_ptr); + // void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + public static native void ChannelDetails_set_balance_msat(long this_ptr, long val); // uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); public static native long ChannelDetails_get_outbound_capacity_msat(long this_ptr); // void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); @@ -3883,8 +3981,8 @@ public class bindings { public static native boolean ChannelDetails_get_is_public(long this_ptr); // void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); public static native void ChannelDetails_set_is_public(long this_ptr, boolean val); - // MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); - public static native long ChannelDetails_new(byte[] channel_id_arg, long counterparty_arg, long funding_txo_arg, long short_channel_id_arg, long channel_value_satoshis_arg, long unspendable_punishment_reserve_arg, long user_channel_id_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, long confirmations_required_arg, long force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg); + // MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); + public static native long ChannelDetails_new(byte[] channel_id_arg, long counterparty_arg, long funding_txo_arg, long short_channel_id_arg, long channel_value_satoshis_arg, long unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, long confirmations_required_arg, long force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg); // uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg); public static native long ChannelDetails_clone_ptr(long arg); // struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); @@ -3925,6 +4023,8 @@ public class bindings { public static native long ChannelManager_send_payment(long this_arg, long route, byte[] payment_hash, byte[] payment_secret); // MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); public static native long ChannelManager_retry_payment(long this_arg, long route, byte[] payment_id); + // void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); + public static native void ChannelManager_abandon_payment(long this_arg, byte[] payment_id); // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); public static native long ChannelManager_send_spontaneous_payment(long this_arg, long route, byte[] payment_preimage); // MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKTransaction funding_transaction); @@ -3941,10 +4041,16 @@ public class bindings { public static native boolean ChannelManager_claim_funds(long this_arg, byte[] payment_preimage); // MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native byte[] ChannelManager_get_our_node_id(long this_arg); - // MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id); - public static native long ChannelManager_create_inbound_payment(long this_arg, long min_value_msat, int invoice_expiry_delta_secs, long user_payment_id); - // MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id); - public static native long ChannelManager_create_inbound_payment_for_hash(long this_arg, byte[] payment_hash, long min_value_msat, int invoice_expiry_delta_secs, long user_payment_id); + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + public static native long ChannelManager_create_inbound_payment(long this_arg, long min_value_msat, int invoice_expiry_delta_secs); + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + public static native long ChannelManager_create_inbound_payment_legacy(long this_arg, long min_value_msat, int invoice_expiry_delta_secs); + // MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + public static native long ChannelManager_create_inbound_payment_for_hash(long this_arg, byte[] payment_hash, long min_value_msat, int invoice_expiry_delta_secs); + // MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + public static native long ChannelManager_create_inbound_payment_for_hash_legacy(long this_arg, byte[] payment_hash, long min_value_msat, int invoice_expiry_delta_secs); + // MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + public static native long ChannelManager_get_payment_preimage(long this_arg, byte[] payment_hash, byte[] payment_secret); // struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); public static native long ChannelManager_as_MessageSendEventsProvider(long this_arg); // struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -4129,6 +4235,10 @@ public class bindings { public static native byte OpenChannel_get_channel_flags(long this_ptr); // void OpenChannel_set_channel_flags(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint8_t val); public static native void OpenChannel_set_channel_flags(long this_ptr, byte val); + // struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); + public static native long OpenChannel_get_channel_type(long this_ptr); + // void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); + public static native void OpenChannel_set_channel_type(long this_ptr, long val); // uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg); public static native long OpenChannel_clone_ptr(long arg); // struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); @@ -4507,8 +4617,8 @@ public class bindings { public static native long NetAddress_ipv4(byte[] addr, short port); // struct LDKNetAddress NetAddress_ipv6(struct LDKSixteenBytes addr, uint16_t port); public static native long NetAddress_ipv6(byte[] addr, short port); - // struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port); - public static native long NetAddress_onion_v2(byte[] addr, short port); + // struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); + public static native long NetAddress_onion_v2(byte[] a); // struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); public static native long NetAddress_onion_v3(byte[] ed25519_pubkey, short checksum, byte version, short port); // struct LDKCVec_u8Z NetAddress_write(const struct LDKNetAddress *NONNULL_PTR obj); @@ -4783,6 +4893,8 @@ public class bindings { public static native long ErrorAction_ignore_error(); // struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); public static native long ErrorAction_ignore_and_log(Level a); + // struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); + public static native long ErrorAction_ignore_duplicate_gossip(); // struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); public static native long ErrorAction_send_error_message(long msg); // void LightningError_free(struct LDKLightningError this_obj); @@ -5043,6 +5155,10 @@ public class bindings { public static native void PeerManager_disconnect_all_peers(long this_arg); // void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); public static native void PeerManager_timer_tick_occurred(long this_arg); + // uint64_t htlc_success_tx_weight(bool opt_anchors); + public static native long htlc_success_tx_weight(boolean opt_anchors); + // uint64_t htlc_timeout_tx_weight(bool opt_anchors); + public static native long htlc_timeout_tx_weight(boolean opt_anchors); // struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); public static native byte[] build_commitment_secret(byte[] commitment_seed, long idx); // struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); @@ -5157,12 +5273,14 @@ public class bindings { public static native byte[] HTLCOutputInCommitment_write(long obj); // struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); public static native long HTLCOutputInCommitment_read(byte[] ser); - // struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); - public static native byte[] get_htlc_redeemscript(long htlc, long keys); + // struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys); + public static native byte[] get_htlc_redeemscript(long htlc, boolean opt_anchors, long keys); // struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); public static native byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory); - // struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); - public static native byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, long htlc, byte[] broadcaster_delayed_payment_key, byte[] revocation_key); + // struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); + public static native byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, long htlc, boolean opt_anchors, byte[] broadcaster_delayed_payment_key, byte[] revocation_key); + // struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); + public static native byte[] get_anchor_redeemscript(byte[] funding_pubkey); // void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); public static native void ChannelTransactionParameters_free(long this_obj); // struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); @@ -5185,8 +5303,12 @@ public class bindings { public static native long ChannelTransactionParameters_get_funding_outpoint(long this_ptr); // void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); public static native void ChannelTransactionParameters_set_funding_outpoint(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg); - public static native long ChannelTransactionParameters_new(long holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, long counterparty_parameters_arg, long funding_outpoint_arg); + // enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + public static native COption_NoneZ ChannelTransactionParameters_get_opt_anchors(long this_ptr); + // void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); + public static native void ChannelTransactionParameters_set_opt_anchors(long this_ptr, COption_NoneZ val); + // MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg); + public static native long ChannelTransactionParameters_new(long holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, long counterparty_parameters_arg, long funding_outpoint_arg, COption_NoneZ opt_anchors_arg); // uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg); public static native long ChannelTransactionParameters_clone_ptr(long arg); // struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); @@ -5233,6 +5355,8 @@ public class bindings { public static native boolean DirectedChannelTransactionParameters_is_outbound(long this_arg); // MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); public static native long DirectedChannelTransactionParameters_funding_outpoint(long this_arg); + // MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); + public static native boolean DirectedChannelTransactionParameters_opt_anchors(long this_arg); // void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); public static native void HolderCommitmentTransaction_free(long this_obj); // struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); @@ -5335,6 +5459,8 @@ public class bindings { public static native long TrustedCommitmentTransaction_built_transaction(long this_arg); // MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); public static native long TrustedCommitmentTransaction_keys(long this_arg); + // MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); + public static native boolean TrustedCommitmentTransaction_opt_anchors(long this_arg); // MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); public static native long TrustedCommitmentTransaction_get_htlc_sigs(long this_arg, byte[] htlc_base_key, long channel_parameters); // uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); @@ -5347,6 +5473,8 @@ public class bindings { public static native boolean ChannelFeatures_eq(long a, long b); // bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); public static native boolean InvoiceFeatures_eq(long a, long b); + // bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); + public static native boolean ChannelTypeFeatures_eq(long a, long b); // uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg); public static native long InitFeatures_clone_ptr(long arg); // struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); @@ -5363,6 +5491,10 @@ public class bindings { public static native long InvoiceFeatures_clone_ptr(long arg); // struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); public static native long InvoiceFeatures_clone(long orig); + // uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg); + public static native long ChannelTypeFeatures_clone_ptr(long arg); + // struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); + public static native long ChannelTypeFeatures_clone(long orig); // void InitFeatures_free(struct LDKInitFeatures this_obj); public static native void InitFeatures_free(long this_obj); // void NodeFeatures_free(struct LDKNodeFeatures this_obj); @@ -5371,6 +5503,8 @@ public class bindings { public static native void ChannelFeatures_free(long this_obj); // void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); public static native void InvoiceFeatures_free(long this_obj); + // void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); + public static native void ChannelTypeFeatures_free(long this_obj); // MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); public static native long InitFeatures_empty(); // MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void); @@ -5395,28 +5529,32 @@ public class bindings { public static native long InvoiceFeatures_known(); // MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); public static native boolean InvoiceFeatures_requires_unknown_bits(long this_arg); - // MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); - public static native boolean InitFeatures_supports_payment_secret(long this_arg); - // MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); - public static native boolean NodeFeatures_supports_payment_secret(long this_arg); - // MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); - public static native boolean InvoiceFeatures_supports_payment_secret(long this_arg); + // MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); + public static native long ChannelTypeFeatures_empty(); + // MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void); + public static native long ChannelTypeFeatures_known(); + // MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + public static native boolean ChannelTypeFeatures_requires_unknown_bits(long this_arg); // struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); public static native byte[] InitFeatures_write(long obj); - // struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); - public static native byte[] NodeFeatures_write(long obj); - // struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); - public static native byte[] ChannelFeatures_write(long obj); - // struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); - public static native byte[] InvoiceFeatures_write(long obj); // struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); public static native long InitFeatures_read(byte[] ser); - // struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); - public static native long NodeFeatures_read(byte[] ser); + // struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); + public static native byte[] ChannelFeatures_write(long obj); // struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); public static native long ChannelFeatures_read(byte[] ser); + // struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); + public static native byte[] NodeFeatures_write(long obj); + // struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); + public static native long NodeFeatures_read(byte[] ser); + // struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); + public static native byte[] InvoiceFeatures_write(long obj); // struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); public static native long InvoiceFeatures_read(byte[] ser); + // struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); + public static native byte[] ChannelTypeFeatures_write(long obj); + // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); + public static native long ChannelTypeFeatures_read(byte[] ser); // void ShutdownScript_free(struct LDKShutdownScript this_obj); public static native void ShutdownScript_free(long this_obj); // uint64_t ShutdownScript_clone_ptr(LDKShutdownScript *NONNULL_PTR arg); @@ -5459,14 +5597,6 @@ public class bindings { public static native long Type_clone(long orig); // void Type_free(struct LDKType this_ptr); public static native void Type_free(long this_ptr); - // void Score_free(struct LDKScore this_ptr); - public static native void Score_free(long this_ptr); - // void LockableScore_free(struct LDKLockableScore this_obj); - public static native void LockableScore_free(long this_obj); - // MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score); - public static native long LockableScore_new(long score); - // struct LDKCVec_u8Z LockableScore_write(const struct LDKLockableScore *NONNULL_PTR obj); - public static native byte[] LockableScore_write(long obj); // void NodeId_free(struct LDKNodeId this_obj); public static native void NodeId_free(long this_obj); // uint64_t NodeId_clone_ptr(LDKNodeId *NONNULL_PTR arg); @@ -5589,8 +5719,6 @@ public class bindings { public static native long ChannelInfo_get_announcement_message(long this_ptr); // void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); public static native void ChannelInfo_set_announcement_message(long this_ptr, long val); - // MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); - public static native long ChannelInfo_new(long features_arg, long node_one_arg, long one_to_two_arg, long node_two_arg, long two_to_one_arg, long capacity_sats_arg, long announcement_message_arg); // uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg); public static native long ChannelInfo_clone_ptr(long arg); // struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); @@ -5699,6 +5827,8 @@ public class bindings { public static native void NetworkGraph_close_channel_from_update(long this_arg, long short_channel_id, boolean is_permanent); // void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); public static native void NetworkGraph_fail_node(long this_arg, byte[] _node_id, boolean is_permanent); + // void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); + public static native void NetworkGraph_remove_stale_channels_with_time(long this_arg, long current_time_unix); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); public static native long NetworkGraph_update_channel(long this_arg, long msg); // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); @@ -5895,6 +6025,14 @@ public class bindings { public static native long RouteHintHop_read(byte[] ser); // struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer); public static native long find_route(byte[] our_node_pubkey, long params, long network, long[] first_hops, long logger, long scorer); + // void Score_free(struct LDKScore this_ptr); + public static native void Score_free(long this_ptr); + // void LockableScore_free(struct LDKLockableScore this_ptr); + public static native void LockableScore_free(long this_ptr); + // void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); + public static native void MultiThreadedLockableScore_free(long this_obj); + // MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); + public static native long MultiThreadedLockableScore_new(long score); // void Scorer_free(struct LDKScorer this_obj); public static native void Scorer_free(long this_obj); // void ScoringParameters_free(struct LDKScoringParameters this_obj); @@ -5907,12 +6045,20 @@ public class bindings { public static native long ScoringParameters_get_failure_penalty_msat(long this_ptr); // void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void ScoringParameters_set_failure_penalty_msat(long this_ptr, long val); + // uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + public static native short ScoringParameters_get_overuse_penalty_start_1024th(long this_ptr); + // void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val); + public static native void ScoringParameters_set_overuse_penalty_start_1024th(long this_ptr, short val); + // uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + public static native long ScoringParameters_get_overuse_penalty_msat_per_1024th(long this_ptr); + // void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + public static native void ScoringParameters_set_overuse_penalty_msat_per_1024th(long this_ptr, long val); // uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr); public static native long ScoringParameters_get_failure_penalty_half_life(long this_ptr); // void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); public static native void ScoringParameters_set_failure_penalty_half_life(long this_ptr, long val); - // MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint64_t failure_penalty_half_life_arg); - public static native long ScoringParameters_new(long base_penalty_msat_arg, long failure_penalty_msat_arg, long failure_penalty_half_life_arg); + // MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg); + public static native long ScoringParameters_new(long base_penalty_msat_arg, long failure_penalty_msat_arg, short overuse_penalty_start_1024th_arg, long overuse_penalty_msat_per_1024th_arg, long failure_penalty_half_life_arg); // struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj); public static native byte[] ScoringParameters_write(long obj); // struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser); @@ -6229,6 +6375,8 @@ public class bindings { public static native CreationError CreationError_timestamp_out_of_bounds(); // enum LDKCreationError CreationError_expiry_time_out_of_bounds(void); public static native CreationError CreationError_expiry_time_out_of_bounds(); + // enum LDKCreationError CreationError_invalid_amount(void); + public static native CreationError CreationError_invalid_amount(); // bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b); public static native boolean CreationError_eq(long a, long b); // struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o); @@ -6307,12 +6455,14 @@ public class bindings { public static native long PaymentError_routing(long a); // struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a); public static native long PaymentError_sending(long a); - // MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts); + // MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts); public static native long InvoicePayer_new(long payer, long router, long scorer, long logger, long event_handler, long retry_attempts); // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice); public static native long InvoicePayer_pay_invoice(long this_arg, long invoice); // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats); public static native long InvoicePayer_pay_zero_value_invoice(long this_arg, long invoice, long amount_msats); + // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); + public static native long InvoicePayer_pay_pubkey(long this_arg, byte[] pubkey, byte[] payment_preimage, long amount_msats, int final_cltv_expiry_delta); // void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); public static native void InvoicePayer_remove_cached_payment(long this_arg, byte[] payment_hash); // struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg); diff --git a/src/main/java/org/ldk/structs/APIError.java b/src/main/java/org/ldk/structs/APIError.java index 1410b0e5..a2e070f9 100644 --- a/src/main/java/org/ldk/structs/APIError.java +++ b/src/main/java/org/ldk/structs/APIError.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -139,6 +140,7 @@ public class APIError extends CommonBase { } long clone_ptr() { long ret = bindings.APIError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -147,6 +149,7 @@ public class APIError extends CommonBase { */ public APIError clone() { long ret = bindings.APIError_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } APIError ret_hu_conv = APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -158,6 +161,7 @@ public class APIError extends CommonBase { */ public static APIError apimisuse_error(java.lang.String err) { long ret = bindings.APIError_apimisuse_error(err); + Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } APIError ret_hu_conv = APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -169,6 +173,8 @@ public class APIError extends CommonBase { */ public static APIError fee_rate_too_high(java.lang.String err, int feerate) { long ret = bindings.APIError_fee_rate_too_high(err, feerate); + Reference.reachabilityFence(err); + Reference.reachabilityFence(feerate); if (ret >= 0 && ret <= 4096) { return null; } APIError ret_hu_conv = APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -180,6 +186,7 @@ public class APIError extends CommonBase { */ public static APIError route_error(java.lang.String err) { long ret = bindings.APIError_route_error(err); + Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } APIError ret_hu_conv = APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -191,6 +198,7 @@ public class APIError extends CommonBase { */ public static APIError channel_unavailable(java.lang.String err) { long ret = bindings.APIError_channel_unavailable(err); + Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } APIError ret_hu_conv = APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -213,6 +221,7 @@ public class APIError extends CommonBase { */ public static APIError incompatible_shutdown_script(ShutdownScript script) { long ret = bindings.APIError_incompatible_shutdown_script(script == null ? 0 : script.ptr & ~1); + Reference.reachabilityFence(script); if (ret >= 0 && ret <= 4096) { return null; } APIError ret_hu_conv = APIError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/AcceptChannel.java b/src/main/java/org/ldk/structs/AcceptChannel.java index ada6053c..70157f07 100644 --- a/src/main/java/org/ldk/structs/AcceptChannel.java +++ b/src/main/java/org/ldk/structs/AcceptChannel.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_temporary_channel_id() { byte[] ret = bindings.AcceptChannel_get_temporary_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class AcceptChannel extends CommonBase { */ public void set_temporary_channel_id(byte[] val) { bindings.AcceptChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class AcceptChannel extends CommonBase { */ public long get_dust_limit_satoshis() { long ret = bindings.AcceptChannel_get_dust_limit_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class AcceptChannel extends CommonBase { */ public void set_dust_limit_satoshis(long val) { bindings.AcceptChannel_set_dust_limit_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class AcceptChannel extends CommonBase { */ public long get_max_htlc_value_in_flight_msat() { long ret = bindings.AcceptChannel_get_max_htlc_value_in_flight_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class AcceptChannel extends CommonBase { */ public void set_max_htlc_value_in_flight_msat(long val) { bindings.AcceptChannel_set_max_htlc_value_in_flight_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class AcceptChannel extends CommonBase { */ public long get_channel_reserve_satoshis() { long ret = bindings.AcceptChannel_get_channel_reserve_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class AcceptChannel extends CommonBase { */ public void set_channel_reserve_satoshis(long val) { bindings.AcceptChannel_set_channel_reserve_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +97,7 @@ public class AcceptChannel extends CommonBase { */ public long get_htlc_minimum_msat() { long ret = bindings.AcceptChannel_get_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +106,8 @@ public class AcceptChannel extends CommonBase { */ public void set_htlc_minimum_msat(long val) { bindings.AcceptChannel_set_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -99,6 +115,7 @@ public class AcceptChannel extends CommonBase { */ public int get_minimum_depth() { int ret = bindings.AcceptChannel_get_minimum_depth(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -107,6 +124,8 @@ public class AcceptChannel extends CommonBase { */ public void set_minimum_depth(int val) { bindings.AcceptChannel_set_minimum_depth(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -114,6 +133,7 @@ public class AcceptChannel extends CommonBase { */ public short get_to_self_delay() { short ret = bindings.AcceptChannel_get_to_self_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -122,6 +142,8 @@ public class AcceptChannel extends CommonBase { */ public void set_to_self_delay(short val) { bindings.AcceptChannel_set_to_self_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -129,6 +151,7 @@ public class AcceptChannel extends CommonBase { */ public short get_max_accepted_htlcs() { short ret = bindings.AcceptChannel_get_max_accepted_htlcs(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -137,6 +160,8 @@ public class AcceptChannel extends CommonBase { */ public void set_max_accepted_htlcs(short val) { bindings.AcceptChannel_set_max_accepted_htlcs(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -144,6 +169,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_funding_pubkey() { byte[] ret = bindings.AcceptChannel_get_funding_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -152,6 +178,8 @@ public class AcceptChannel extends CommonBase { */ public void set_funding_pubkey(byte[] val) { bindings.AcceptChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -159,6 +187,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_revocation_basepoint() { byte[] ret = bindings.AcceptChannel_get_revocation_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -167,6 +196,8 @@ public class AcceptChannel extends CommonBase { */ public void set_revocation_basepoint(byte[] val) { bindings.AcceptChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -174,6 +205,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_payment_point() { byte[] ret = bindings.AcceptChannel_get_payment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -182,6 +214,8 @@ public class AcceptChannel extends CommonBase { */ public void set_payment_point(byte[] val) { bindings.AcceptChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -189,6 +223,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_delayed_payment_basepoint() { byte[] ret = bindings.AcceptChannel_get_delayed_payment_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -197,6 +232,8 @@ public class AcceptChannel extends CommonBase { */ public void set_delayed_payment_basepoint(byte[] val) { bindings.AcceptChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -204,6 +241,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_htlc_basepoint() { byte[] ret = bindings.AcceptChannel_get_htlc_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -212,6 +250,8 @@ public class AcceptChannel extends CommonBase { */ public void set_htlc_basepoint(byte[] val) { bindings.AcceptChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -219,6 +259,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] get_first_per_commitment_point() { byte[] ret = bindings.AcceptChannel_get_first_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -227,10 +268,13 @@ public class AcceptChannel extends CommonBase { */ public void set_first_per_commitment_point(byte[] val) { bindings.AcceptChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.AcceptChannel_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -239,6 +283,7 @@ public class AcceptChannel extends CommonBase { */ public AcceptChannel clone() { long ret = bindings.AcceptChannel_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } AcceptChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new AcceptChannel(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -250,6 +295,7 @@ public class AcceptChannel extends CommonBase { */ public byte[] write() { byte[] ret = bindings.AcceptChannel_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -258,6 +304,7 @@ public class AcceptChannel extends CommonBase { */ public static Result_AcceptChannelDecodeErrorZ read(byte[] ser) { long ret = bindings.AcceptChannel_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Access.java b/src/main/java/org/ldk/structs/Access.java index e4c1954e..b80661ba 100644 --- a/src/main/java/org/ldk/structs/Access.java +++ b/src/main/java/org/ldk/structs/Access.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -55,6 +56,9 @@ public class Access extends CommonBase { */ public Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id) { long ret = bindings.Access_get_utxo(this.ptr, InternalUtils.check_arr_len(genesis_hash, 32), short_channel_id); + Reference.reachabilityFence(this); + Reference.reachabilityFence(genesis_hash); + Reference.reachabilityFence(short_channel_id); if (ret >= 0 && ret <= 4096) { return null; } Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/AnnouncementSignatures.java b/src/main/java/org/ldk/structs/AnnouncementSignatures.java index 48e31a41..d4a712f3 100644 --- a/src/main/java/org/ldk/structs/AnnouncementSignatures.java +++ b/src/main/java/org/ldk/structs/AnnouncementSignatures.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class AnnouncementSignatures extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.AnnouncementSignatures_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class AnnouncementSignatures extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.AnnouncementSignatures_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class AnnouncementSignatures extends CommonBase { */ public long get_short_channel_id() { long ret = bindings.AnnouncementSignatures_get_short_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class AnnouncementSignatures extends CommonBase { */ public void set_short_channel_id(long val) { bindings.AnnouncementSignatures_set_short_channel_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class AnnouncementSignatures extends CommonBase { */ public byte[] get_node_signature() { byte[] ret = bindings.AnnouncementSignatures_get_node_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class AnnouncementSignatures extends CommonBase { */ public void set_node_signature(byte[] val) { bindings.AnnouncementSignatures_set_node_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class AnnouncementSignatures extends CommonBase { */ public byte[] get_bitcoin_signature() { byte[] ret = bindings.AnnouncementSignatures_get_bitcoin_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class AnnouncementSignatures extends CommonBase { */ public void set_bitcoin_signature(byte[] val) { bindings.AnnouncementSignatures_set_bitcoin_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +97,10 @@ public class AnnouncementSignatures extends CommonBase { */ public static AnnouncementSignatures of(byte[] channel_id_arg, long short_channel_id_arg, byte[] node_signature_arg, byte[] bitcoin_signature_arg) { long ret = bindings.AnnouncementSignatures_new(InternalUtils.check_arr_len(channel_id_arg, 32), short_channel_id_arg, InternalUtils.check_arr_len(node_signature_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_arg, 64)); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(short_channel_id_arg); + Reference.reachabilityFence(node_signature_arg); + Reference.reachabilityFence(bitcoin_signature_arg); if (ret >= 0 && ret <= 4096) { return null; } AnnouncementSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new AnnouncementSignatures(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -92,6 +109,7 @@ public class AnnouncementSignatures extends CommonBase { long clone_ptr() { long ret = bindings.AnnouncementSignatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -100,6 +118,7 @@ public class AnnouncementSignatures extends CommonBase { */ public AnnouncementSignatures clone() { long ret = bindings.AnnouncementSignatures_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } AnnouncementSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new AnnouncementSignatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -111,6 +130,7 @@ public class AnnouncementSignatures extends CommonBase { */ public byte[] write() { byte[] ret = bindings.AnnouncementSignatures_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -119,6 +139,7 @@ public class AnnouncementSignatures extends CommonBase { */ public static Result_AnnouncementSignaturesDecodeErrorZ read(byte[] ser) { long ret = bindings.AnnouncementSignatures_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_AnnouncementSignaturesDecodeErrorZ ret_hu_conv = Result_AnnouncementSignaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/BackgroundProcessor.java b/src/main/java/org/ldk/structs/BackgroundProcessor.java index 6f60b92d..a080a038 100644 --- a/src/main/java/org/ldk/structs/BackgroundProcessor.java +++ b/src/main/java/org/ldk/structs/BackgroundProcessor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -17,6 +18,8 @@ import javax.annotation.Nullable; * [`ChannelManager`] persistence should be done in the background. * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`] * at the appropriate intervals. + * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to + * [`BackgroundProcessor::start`]). * * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied * upon as doing so may result in high latency. @@ -67,7 +70,7 @@ public class BackgroundProcessor extends CommonBase { * functionality implemented by other handlers. * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures. * - * [top-level documentation]: Self + * [top-level documentation]: BackgroundProcessor * [`join`]: Self::join * [`stop`]: Self::stop * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager @@ -79,6 +82,13 @@ public class BackgroundProcessor extends CommonBase { */ public static BackgroundProcessor start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, @Nullable NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) { long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, net_graph_msg_handler == null ? 0 : net_graph_msg_handler.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(persister); + Reference.reachabilityFence(event_handler); + Reference.reachabilityFence(chain_monitor); + Reference.reachabilityFence(channel_manager); + Reference.reachabilityFence(net_graph_msg_handler); + Reference.reachabilityFence(peer_manager); + Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } BackgroundProcessor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BackgroundProcessor(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -105,6 +115,7 @@ public class BackgroundProcessor extends CommonBase { */ public Result_NoneErrorZ join() { long ret = bindings.BackgroundProcessor_join(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); this.ptrs_to.add(this); @@ -132,6 +143,7 @@ public class BackgroundProcessor extends CommonBase { */ public Result_NoneErrorZ stop() { long ret = bindings.BackgroundProcessor_stop(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); this.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Balance.java b/src/main/java/org/ldk/structs/Balance.java index 429335b4..2640ac69 100644 --- a/src/main/java/org/ldk/structs/Balance.java +++ b/src/main/java/org/ldk/structs/Balance.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -125,6 +126,7 @@ public class Balance extends CommonBase { } long clone_ptr() { long ret = bindings.Balance_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -133,6 +135,7 @@ public class Balance extends CommonBase { */ public Balance clone() { long ret = bindings.Balance_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Balance ret_hu_conv = Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -144,6 +147,7 @@ public class Balance extends CommonBase { */ public static Balance claimable_on_channel_close(long claimable_amount_satoshis) { long ret = bindings.Balance_claimable_on_channel_close(claimable_amount_satoshis); + Reference.reachabilityFence(claimable_amount_satoshis); if (ret >= 0 && ret <= 4096) { return null; } Balance ret_hu_conv = Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -155,6 +159,8 @@ public class Balance extends CommonBase { */ public static Balance claimable_awaiting_confirmations(long claimable_amount_satoshis, int confirmation_height) { long ret = bindings.Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height); + Reference.reachabilityFence(claimable_amount_satoshis); + Reference.reachabilityFence(confirmation_height); if (ret >= 0 && ret <= 4096) { return null; } Balance ret_hu_conv = Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -166,6 +172,8 @@ public class Balance extends CommonBase { */ public static Balance contentious_claimable(long claimable_amount_satoshis, int timeout_height) { long ret = bindings.Balance_contentious_claimable(claimable_amount_satoshis, timeout_height); + Reference.reachabilityFence(claimable_amount_satoshis); + Reference.reachabilityFence(timeout_height); if (ret >= 0 && ret <= 4096) { return null; } Balance ret_hu_conv = Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -177,6 +185,8 @@ public class Balance extends CommonBase { */ public static Balance maybe_claimable_htlcawaiting_timeout(long claimable_amount_satoshis, int claimable_height) { long ret = bindings.Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height); + Reference.reachabilityFence(claimable_amount_satoshis); + Reference.reachabilityFence(claimable_height); if (ret >= 0 && ret <= 4096) { return null; } Balance ret_hu_conv = Balance.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -189,7 +199,13 @@ public class Balance extends CommonBase { */ public boolean eq(Balance b) { boolean ret = bindings.Balance_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Balance)) return false; + return this.eq((Balance)o); + } } diff --git a/src/main/java/org/ldk/structs/BaseSign.java b/src/main/java/org/ldk/structs/BaseSign.java index 267da1e7..11d55c96 100644 --- a/src/main/java/org/ldk/structs/BaseSign.java +++ b/src/main/java/org/ldk/structs/BaseSign.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -274,6 +275,8 @@ public class BaseSign extends CommonBase { */ public byte[] get_per_commitment_point(long idx) { byte[] ret = bindings.BaseSign_get_per_commitment_point(this.ptr, idx); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); return ret; } @@ -289,6 +292,8 @@ public class BaseSign extends CommonBase { */ public byte[] release_commitment_secret(long idx) { byte[] ret = bindings.BaseSign_release_commitment_secret(this.ptr, idx); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); return ret; } @@ -302,6 +307,8 @@ public class BaseSign extends CommonBase { */ public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx) { long ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(holder_tx); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); this.ptrs_to.add(holder_tx); @@ -315,6 +322,7 @@ public class BaseSign extends CommonBase { */ public byte[] channel_keys_id() { byte[] ret = bindings.BaseSign_channel_keys_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -328,6 +336,8 @@ public class BaseSign extends CommonBase { */ public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) { long ret = bindings.BaseSign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(commitment_tx); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(commitment_tx); @@ -342,6 +352,9 @@ public class BaseSign extends CommonBase { */ public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) { long ret = bindings.BaseSign_validate_counterparty_revocation(this.ptr, idx, InternalUtils.check_arr_len(secret, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(idx); + Reference.reachabilityFence(secret); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -362,6 +375,8 @@ public class BaseSign extends CommonBase { */ public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) { long ret = bindings.BaseSign_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(commitment_tx); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(commitment_tx); @@ -386,6 +401,11 @@ public class BaseSign extends CommonBase { */ public Result_SignatureNoneZ sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key) { long ret = bindings.BaseSign_sign_justice_revoked_output(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(justice_tx); + Reference.reachabilityFence(input); + Reference.reachabilityFence(amount); + Reference.reachabilityFence(per_commitment_key); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -412,6 +432,12 @@ public class BaseSign extends CommonBase { */ public Result_SignatureNoneZ sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, HTLCOutputInCommitment htlc) { long ret = bindings.BaseSign_sign_justice_revoked_htlc(this.ptr, justice_tx, input, amount, InternalUtils.check_arr_len(per_commitment_key, 32), htlc == null ? 0 : htlc.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(justice_tx); + Reference.reachabilityFence(input); + Reference.reachabilityFence(amount); + Reference.reachabilityFence(per_commitment_key); + Reference.reachabilityFence(htlc); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); this.ptrs_to.add(htlc); @@ -439,6 +465,12 @@ public class BaseSign extends CommonBase { */ public Result_SignatureNoneZ sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, HTLCOutputInCommitment htlc) { long ret = bindings.BaseSign_sign_counterparty_htlc_transaction(this.ptr, htlc_tx, input, amount, InternalUtils.check_arr_len(per_commitment_point, 33), htlc == null ? 0 : htlc.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(htlc_tx); + Reference.reachabilityFence(input); + Reference.reachabilityFence(amount); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(htlc); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); this.ptrs_to.add(htlc); @@ -453,6 +485,8 @@ public class BaseSign extends CommonBase { */ public Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx) { long ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(closing_tx); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); this.ptrs_to.add(closing_tx); @@ -469,6 +503,8 @@ public class BaseSign extends CommonBase { */ public Result_SignatureNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) { long ret = bindings.BaseSign_sign_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -489,6 +525,8 @@ public class BaseSign extends CommonBase { */ public void ready_channel(ChannelTransactionParameters channel_parameters) { bindings.BaseSign_ready_channel(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_parameters); this.ptrs_to.add(channel_parameters); } @@ -498,6 +536,7 @@ public class BaseSign extends CommonBase { */ public ChannelPublicKeys get_pubkeys() { long ret = bindings.BaseSign_get_pubkeys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/BestBlock.java b/src/main/java/org/ldk/structs/BestBlock.java index a595ed02..f746b47d 100644 --- a/src/main/java/org/ldk/structs/BestBlock.java +++ b/src/main/java/org/ldk/structs/BestBlock.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class BestBlock extends CommonBase { long clone_ptr() { long ret = bindings.BestBlock_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class BestBlock extends CommonBase { */ public BestBlock clone() { long ret = bindings.BestBlock_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -41,6 +44,7 @@ public class BestBlock extends CommonBase { */ public static BestBlock from_genesis(org.ldk.enums.Network network) { long ret = bindings.BestBlock_from_genesis(network); + Reference.reachabilityFence(network); if (ret >= 0 && ret <= 4096) { return null; } BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -52,6 +56,8 @@ public class BestBlock extends CommonBase { */ public static BestBlock of(byte[] block_hash, int height) { long ret = bindings.BestBlock_new(InternalUtils.check_arr_len(block_hash, 32), height); + Reference.reachabilityFence(block_hash); + Reference.reachabilityFence(height); if (ret >= 0 && ret <= 4096) { return null; } BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -63,6 +69,7 @@ public class BestBlock extends CommonBase { */ public byte[] block_hash() { byte[] ret = bindings.BestBlock_block_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -71,6 +78,7 @@ public class BestBlock extends CommonBase { */ public int height() { int ret = bindings.BestBlock_height(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/BroadcasterInterface.java b/src/main/java/org/ldk/structs/BroadcasterInterface.java index 5e6a76f8..5052076d 100644 --- a/src/main/java/org/ldk/structs/BroadcasterInterface.java +++ b/src/main/java/org/ldk/structs/BroadcasterInterface.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -44,6 +45,8 @@ public class BroadcasterInterface extends CommonBase { */ public void broadcast_transaction(byte[] tx) { bindings.BroadcasterInterface_broadcast_transaction(this.ptr, tx); + Reference.reachabilityFence(this); + Reference.reachabilityFence(tx); } } diff --git a/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java b/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java index e30cbf02..2df19906 100644 --- a/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/BuiltCommitmentTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public byte[] get_transaction() { byte[] ret = bindings.BuiltCommitmentTransaction_get_transaction(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public void set_transaction(byte[] val) { bindings.BuiltCommitmentTransaction_set_transaction(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public byte[] get_txid() { byte[] ret = bindings.BuiltCommitmentTransaction_get_txid(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +58,8 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public void set_txid(byte[] val) { bindings.BuiltCommitmentTransaction_set_txid(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -60,6 +67,8 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public static BuiltCommitmentTransaction of(byte[] transaction_arg, byte[] txid_arg) { long ret = bindings.BuiltCommitmentTransaction_new(transaction_arg, InternalUtils.check_arr_len(txid_arg, 32)); + Reference.reachabilityFence(transaction_arg); + Reference.reachabilityFence(txid_arg); if (ret >= 0 && ret <= 4096) { return null; } BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BuiltCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -68,6 +77,7 @@ public class BuiltCommitmentTransaction extends CommonBase { long clone_ptr() { long ret = bindings.BuiltCommitmentTransaction_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -76,6 +86,7 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public BuiltCommitmentTransaction clone() { long ret = bindings.BuiltCommitmentTransaction_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BuiltCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -87,6 +98,7 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public byte[] write() { byte[] ret = bindings.BuiltCommitmentTransaction_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -95,6 +107,7 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public static Result_BuiltCommitmentTransactionDecodeErrorZ read(byte[] ser) { long ret = bindings.BuiltCommitmentTransaction_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -107,6 +120,9 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) { byte[] ret = bindings.BuiltCommitmentTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_redeemscript); + Reference.reachabilityFence(channel_value_satoshis); return ret; } @@ -116,6 +132,10 @@ public class BuiltCommitmentTransaction extends CommonBase { */ public byte[] sign(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) { byte[] ret = bindings.BuiltCommitmentTransaction_sign(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_key); + Reference.reachabilityFence(funding_redeemscript); + Reference.reachabilityFence(channel_value_satoshis); return ret; } diff --git a/src/main/java/org/ldk/structs/ChainMonitor.java b/src/main/java/org/ldk/structs/ChainMonitor.java index c9a4c6e1..8695b951 100644 --- a/src/main/java/org/ldk/structs/ChainMonitor.java +++ b/src/main/java/org/ldk/structs/ChainMonitor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -38,6 +39,11 @@ public class ChainMonitor extends CommonBase { */ public static ChainMonitor of(Option_FilterZ chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) { long ret = bindings.ChainMonitor_new(chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr); + Reference.reachabilityFence(chain_source); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(feeest); + Reference.reachabilityFence(persister); if (ret >= 0 && ret <= 4096) { return null; } ChainMonitor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChainMonitor(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -62,6 +68,8 @@ public class ChainMonitor extends CommonBase { */ public Balance[] get_claimable_balances(ChannelDetails[] ignored_channels) { long[] ret = bindings.ChainMonitor_get_claimable_balances(this.ptr, ignored_channels != null ? Arrays.stream(ignored_channels).mapToLong(ignored_channels_conv_16 -> ignored_channels_conv_16 == null ? 0 : ignored_channels_conv_16.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(ignored_channels); Balance[] ret_conv_9_arr = new Balance[ret.length]; for (int j = 0; j < ret.length; j++) { long ret_conv_9 = ret[j]; @@ -81,6 +89,8 @@ public class ChainMonitor extends CommonBase { */ public Result_LockedChannelMonitorNoneZ get_monitor(OutPoint funding_txo) { long ret = bindings.ChainMonitor_get_monitor(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_txo); if (ret >= 0 && ret <= 4096) { return null; } Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -94,6 +104,7 @@ public class ChainMonitor extends CommonBase { */ public OutPoint[] list_monitors() { long[] ret = bindings.ChainMonitor_list_monitors(this.ptr); + Reference.reachabilityFence(this); OutPoint[] ret_conv_10_arr = new OutPoint[ret.length]; for (int k = 0; k < ret.length; k++) { long ret_conv_10 = ret[k]; @@ -121,6 +132,9 @@ public class ChainMonitor extends CommonBase { */ public Result_NoneAPIErrorZ channel_monitor_updated(OutPoint funding_txo, MonitorUpdateId completed_update_id) { long ret = bindings.ChainMonitor_channel_monitor_updated(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, completed_update_id == null ? 0 : completed_update_id.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_txo); + Reference.reachabilityFence(completed_update_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -132,6 +146,7 @@ public class ChainMonitor extends CommonBase { */ public Listen as_Listen() { long ret = bindings.ChainMonitor_as_Listen(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Listen ret_hu_conv = new Listen(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -144,6 +159,7 @@ public class ChainMonitor extends CommonBase { */ public Confirm as_Confirm() { long ret = bindings.ChainMonitor_as_Confirm(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Confirm ret_hu_conv = new Confirm(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -156,6 +172,7 @@ public class ChainMonitor extends CommonBase { */ public Watch as_Watch() { long ret = bindings.ChainMonitor_as_Watch(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Watch ret_hu_conv = new Watch(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -168,6 +185,7 @@ public class ChainMonitor extends CommonBase { */ public EventsProvider as_EventsProvider() { long ret = bindings.ChainMonitor_as_EventsProvider(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } EventsProvider ret_hu_conv = new EventsProvider(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChainParameters.java b/src/main/java/org/ldk/structs/ChainParameters.java index 3d047d0b..72aafcf4 100644 --- a/src/main/java/org/ldk/structs/ChainParameters.java +++ b/src/main/java/org/ldk/structs/ChainParameters.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -28,6 +29,7 @@ public class ChainParameters extends CommonBase { */ public Network get_network() { Network ret = bindings.ChainParameters_get_network(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -36,6 +38,8 @@ public class ChainParameters extends CommonBase { */ public void set_network(org.ldk.enums.Network val) { bindings.ChainParameters_set_network(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -45,6 +49,7 @@ public class ChainParameters extends CommonBase { */ public BestBlock get_best_block() { long ret = bindings.ChainParameters_get_best_block(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -58,6 +63,8 @@ public class ChainParameters extends CommonBase { */ public void set_best_block(BestBlock val) { bindings.ChainParameters_set_best_block(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -65,6 +72,8 @@ public class ChainParameters extends CommonBase { */ public static ChainParameters of(org.ldk.enums.Network network_arg, BestBlock best_block_arg) { long ret = bindings.ChainParameters_new(network_arg, best_block_arg == null ? 0 : best_block_arg.ptr & ~1); + Reference.reachabilityFence(network_arg); + Reference.reachabilityFence(best_block_arg); if (ret >= 0 && ret <= 4096) { return null; } ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChainParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -73,6 +82,7 @@ public class ChainParameters extends CommonBase { long clone_ptr() { long ret = bindings.ChainParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -81,6 +91,7 @@ public class ChainParameters extends CommonBase { */ public ChainParameters clone() { long ret = bindings.ChainParameters_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChainParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChainParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChannelAnnouncement.java b/src/main/java/org/ldk/structs/ChannelAnnouncement.java index 9382ad91..8ab2d90c 100644 --- a/src/main/java/org/ldk/structs/ChannelAnnouncement.java +++ b/src/main/java/org/ldk/structs/ChannelAnnouncement.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ChannelAnnouncement extends CommonBase { */ public byte[] get_node_signature_1() { byte[] ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class ChannelAnnouncement extends CommonBase { */ public void set_node_signature_1(byte[] val) { bindings.ChannelAnnouncement_set_node_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class ChannelAnnouncement extends CommonBase { */ public byte[] get_node_signature_2() { byte[] ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class ChannelAnnouncement extends CommonBase { */ public void set_node_signature_2(byte[] val) { bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class ChannelAnnouncement extends CommonBase { */ public byte[] get_bitcoin_signature_1() { byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class ChannelAnnouncement extends CommonBase { */ public void set_bitcoin_signature_1(byte[] val) { bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class ChannelAnnouncement extends CommonBase { */ public byte[] get_bitcoin_signature_2() { byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class ChannelAnnouncement extends CommonBase { */ public void set_bitcoin_signature_2(byte[] val) { bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +97,7 @@ public class ChannelAnnouncement extends CommonBase { */ public UnsignedChannelAnnouncement get_contents() { long ret = bindings.ChannelAnnouncement_get_contents(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -95,6 +109,8 @@ public class ChannelAnnouncement extends CommonBase { */ public void set_contents(UnsignedChannelAnnouncement val) { bindings.ChannelAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -102,6 +118,11 @@ public class ChannelAnnouncement extends CommonBase { */ public static ChannelAnnouncement of(byte[] node_signature_1_arg, byte[] node_signature_2_arg, byte[] bitcoin_signature_1_arg, byte[] bitcoin_signature_2_arg, UnsignedChannelAnnouncement contents_arg) { long ret = bindings.ChannelAnnouncement_new(InternalUtils.check_arr_len(node_signature_1_arg, 64), InternalUtils.check_arr_len(node_signature_2_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_1_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_2_arg, 64), contents_arg == null ? 0 : contents_arg.ptr & ~1); + Reference.reachabilityFence(node_signature_1_arg); + Reference.reachabilityFence(node_signature_2_arg); + Reference.reachabilityFence(bitcoin_signature_1_arg); + Reference.reachabilityFence(bitcoin_signature_2_arg); + Reference.reachabilityFence(contents_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -110,6 +131,7 @@ public class ChannelAnnouncement extends CommonBase { long clone_ptr() { long ret = bindings.ChannelAnnouncement_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -118,6 +140,7 @@ public class ChannelAnnouncement extends CommonBase { */ public ChannelAnnouncement clone() { long ret = bindings.ChannelAnnouncement_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -129,6 +152,7 @@ public class ChannelAnnouncement extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelAnnouncement_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -137,6 +161,7 @@ public class ChannelAnnouncement extends CommonBase { */ public static Result_ChannelAnnouncementDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelAnnouncement_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelConfig.java b/src/main/java/org/ldk/structs/ChannelConfig.java index e1c95b64..eda992d4 100644 --- a/src/main/java/org/ldk/structs/ChannelConfig.java +++ b/src/main/java/org/ldk/structs/ChannelConfig.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -30,6 +31,7 @@ public class ChannelConfig extends CommonBase { */ public int get_forwarding_fee_proportional_millionths() { int ret = bindings.ChannelConfig_get_forwarding_fee_proportional_millionths(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -43,6 +45,8 @@ public class ChannelConfig extends CommonBase { */ public void set_forwarding_fee_proportional_millionths(int val) { bindings.ChannelConfig_set_forwarding_fee_proportional_millionths(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -61,6 +65,7 @@ public class ChannelConfig extends CommonBase { */ public int get_forwarding_fee_base_msat() { int ret = bindings.ChannelConfig_get_forwarding_fee_base_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,8 @@ public class ChannelConfig extends CommonBase { */ public void set_forwarding_fee_base_msat(int val) { bindings.ChannelConfig_set_forwarding_fee_base_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -105,6 +112,7 @@ public class ChannelConfig extends CommonBase { */ public short get_cltv_expiry_delta() { short ret = bindings.ChannelConfig_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -131,6 +139,8 @@ public class ChannelConfig extends CommonBase { */ public void set_cltv_expiry_delta(short val) { bindings.ChannelConfig_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -148,6 +158,7 @@ public class ChannelConfig extends CommonBase { */ public boolean get_announced_channel() { boolean ret = bindings.ChannelConfig_get_announced_channel(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -166,6 +177,8 @@ public class ChannelConfig extends CommonBase { */ public void set_announced_channel(boolean val) { bindings.ChannelConfig_set_announced_channel(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -183,6 +196,7 @@ public class ChannelConfig extends CommonBase { */ public boolean get_commit_upfront_shutdown_pubkey() { boolean ret = bindings.ChannelConfig_get_commit_upfront_shutdown_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -201,6 +215,8 @@ public class ChannelConfig extends CommonBase { */ public void set_commit_upfront_shutdown_pubkey(boolean val) { bindings.ChannelConfig_set_commit_upfront_shutdown_pubkey(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -222,6 +238,7 @@ public class ChannelConfig extends CommonBase { */ public long get_max_dust_htlc_exposure_msat() { long ret = bindings.ChannelConfig_get_max_dust_htlc_exposure_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -244,6 +261,8 @@ public class ChannelConfig extends CommonBase { */ public void set_max_dust_htlc_exposure_msat(long val) { bindings.ChannelConfig_set_max_dust_htlc_exposure_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -272,6 +291,7 @@ public class ChannelConfig extends CommonBase { */ public long get_force_close_avoidance_max_fee_satoshis() { long ret = bindings.ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -301,6 +321,8 @@ public class ChannelConfig extends CommonBase { */ public void set_force_close_avoidance_max_fee_satoshis(long val) { bindings.ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -308,6 +330,13 @@ public class ChannelConfig extends CommonBase { */ public static ChannelConfig of(int forwarding_fee_proportional_millionths_arg, int forwarding_fee_base_msat_arg, short cltv_expiry_delta_arg, boolean announced_channel_arg, boolean commit_upfront_shutdown_pubkey_arg, long max_dust_htlc_exposure_msat_arg, long force_close_avoidance_max_fee_satoshis_arg) { long ret = bindings.ChannelConfig_new(forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat_arg, cltv_expiry_delta_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg, max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis_arg); + Reference.reachabilityFence(forwarding_fee_proportional_millionths_arg); + Reference.reachabilityFence(forwarding_fee_base_msat_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); + Reference.reachabilityFence(announced_channel_arg); + Reference.reachabilityFence(commit_upfront_shutdown_pubkey_arg); + Reference.reachabilityFence(max_dust_htlc_exposure_msat_arg); + Reference.reachabilityFence(force_close_avoidance_max_fee_satoshis_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -316,6 +345,7 @@ public class ChannelConfig extends CommonBase { long clone_ptr() { long ret = bindings.ChannelConfig_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -324,6 +354,7 @@ public class ChannelConfig extends CommonBase { */ public ChannelConfig clone() { long ret = bindings.ChannelConfig_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -346,6 +377,7 @@ public class ChannelConfig extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelConfig_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -354,6 +386,7 @@ public class ChannelConfig extends CommonBase { */ public static Result_ChannelConfigDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelConfig_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelCounterparty.java b/src/main/java/org/ldk/structs/ChannelCounterparty.java index 51de1b27..d355cbf1 100644 --- a/src/main/java/org/ldk/structs/ChannelCounterparty.java +++ b/src/main/java/org/ldk/structs/ChannelCounterparty.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class ChannelCounterparty extends CommonBase { */ public byte[] get_node_id() { byte[] ret = bindings.ChannelCounterparty_get_node_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -33,6 +35,8 @@ public class ChannelCounterparty extends CommonBase { */ public void set_node_id(byte[] val) { bindings.ChannelCounterparty_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class ChannelCounterparty extends CommonBase { */ public InitFeatures get_features() { long ret = bindings.ChannelCounterparty_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -55,6 +60,8 @@ public class ChannelCounterparty extends CommonBase { */ public void set_features(InitFeatures val) { bindings.ChannelCounterparty_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -68,6 +75,7 @@ public class ChannelCounterparty extends CommonBase { */ public long get_unspendable_punishment_reserve() { long ret = bindings.ChannelCounterparty_get_unspendable_punishment_reserve(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -82,6 +90,8 @@ public class ChannelCounterparty extends CommonBase { */ public void set_unspendable_punishment_reserve(long val) { bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -93,6 +103,7 @@ public class ChannelCounterparty extends CommonBase { @Nullable public CounterpartyForwardingInfo get_forwarding_info() { long ret = bindings.ChannelCounterparty_get_forwarding_info(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CounterpartyForwardingInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyForwardingInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -107,6 +118,8 @@ public class ChannelCounterparty extends CommonBase { */ public void set_forwarding_info(@Nullable CounterpartyForwardingInfo val) { bindings.ChannelCounterparty_set_forwarding_info(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -114,6 +127,10 @@ public class ChannelCounterparty extends CommonBase { */ public static ChannelCounterparty of(byte[] node_id_arg, InitFeatures features_arg, long unspendable_punishment_reserve_arg, CounterpartyForwardingInfo forwarding_info_arg) { long ret = bindings.ChannelCounterparty_new(InternalUtils.check_arr_len(node_id_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, unspendable_punishment_reserve_arg, forwarding_info_arg == null ? 0 : forwarding_info_arg.ptr & ~1); + Reference.reachabilityFence(node_id_arg); + Reference.reachabilityFence(features_arg); + Reference.reachabilityFence(unspendable_punishment_reserve_arg); + Reference.reachabilityFence(forwarding_info_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelCounterparty(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -122,6 +139,7 @@ public class ChannelCounterparty extends CommonBase { long clone_ptr() { long ret = bindings.ChannelCounterparty_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -130,6 +148,7 @@ public class ChannelCounterparty extends CommonBase { */ public ChannelCounterparty clone() { long ret = bindings.ChannelCounterparty_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelCounterparty(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChannelDetails.java b/src/main/java/org/ldk/structs/ChannelDetails.java index 85a710f8..8babf959 100644 --- a/src/main/java/org/ldk/structs/ChannelDetails.java +++ b/src/main/java/org/ldk/structs/ChannelDetails.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class ChannelDetails extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.ChannelDetails_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -38,6 +40,8 @@ public class ChannelDetails extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.ChannelDetails_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -45,6 +49,7 @@ public class ChannelDetails extends CommonBase { */ public ChannelCounterparty get_counterparty() { long ret = bindings.ChannelDetails_get_counterparty(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelCounterparty ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelCounterparty(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -56,6 +61,8 @@ public class ChannelDetails extends CommonBase { */ public void set_counterparty(ChannelCounterparty val) { bindings.ChannelDetails_set_counterparty(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -70,6 +77,7 @@ public class ChannelDetails extends CommonBase { @Nullable public OutPoint get_funding_txo() { long ret = bindings.ChannelDetails_get_funding_txo(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -87,6 +95,8 @@ public class ChannelDetails extends CommonBase { */ public void set_funding_txo(@Nullable OutPoint val) { bindings.ChannelDetails_set_funding_txo(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -95,6 +105,7 @@ public class ChannelDetails extends CommonBase { */ public Option_u64Z get_short_channel_id() { long ret = bindings.ChannelDetails_get_short_channel_id(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -107,6 +118,8 @@ public class ChannelDetails extends CommonBase { */ public void set_short_channel_id(Option_u64Z val) { bindings.ChannelDetails_set_short_channel_id(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -114,6 +127,7 @@ public class ChannelDetails extends CommonBase { */ public long get_channel_value_satoshis() { long ret = bindings.ChannelDetails_get_channel_value_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -122,6 +136,8 @@ public class ChannelDetails extends CommonBase { */ public void set_channel_value_satoshis(long val) { bindings.ChannelDetails_set_channel_value_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -137,6 +153,7 @@ public class ChannelDetails extends CommonBase { */ public Option_u64Z get_unspendable_punishment_reserve() { long ret = bindings.ChannelDetails_get_unspendable_punishment_reserve(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -156,6 +173,8 @@ public class ChannelDetails extends CommonBase { */ public void set_unspendable_punishment_reserve(Option_u64Z val) { bindings.ChannelDetails_set_unspendable_punishment_reserve(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -163,6 +182,7 @@ public class ChannelDetails extends CommonBase { */ public long get_user_channel_id() { long ret = bindings.ChannelDetails_get_user_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -171,40 +191,85 @@ public class ChannelDetails extends CommonBase { */ public void set_user_channel_id(long val) { bindings.ChannelDetails_set_user_channel_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Our total balance. This is the amount we would get if we close the channel. + * This value is not exact. Due to various in-flight changes and feerate changes, exactly this + * amount is not likely to be recoverable on close. + * + * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose + * balance is not available for inclusion in new outbound HTLCs). This further does not include + * any pending outgoing HTLCs which are awaiting some other resolution to be sent. + * This does not consider any on-chain fees. + * + * See also [`ChannelDetails::outbound_capacity_msat`] + */ + public long get_balance_msat() { + long ret = bindings.ChannelDetails_get_balance_msat(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Our total balance. This is the amount we would get if we close the channel. + * This value is not exact. Due to various in-flight changes and feerate changes, exactly this + * amount is not likely to be recoverable on close. + * + * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose + * balance is not available for inclusion in new outbound HTLCs). This further does not include + * any pending outgoing HTLCs which are awaiting some other resolution to be sent. + * This does not consider any on-chain fees. + * + * See also [`ChannelDetails::outbound_capacity_msat`] + */ + public void set_balance_msat(long val) { + bindings.ChannelDetails_set_balance_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. * + * See also [`ChannelDetails::balance_msat`] + * * This value is not exact. Due to various in-flight changes, feerate changes, and our * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we * should be able to spend nearly this amount. */ public long get_outbound_capacity_msat() { long ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. * + * See also [`ChannelDetails::balance_msat`] + * * This value is not exact. Due to various in-flight changes, feerate changes, and our * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we * should be able to spend nearly this amount. */ public void set_outbound_capacity_msat(long val) { bindings.ChannelDetails_set_outbound_capacity_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new inbound HTLCs). * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. @@ -215,12 +280,13 @@ public class ChannelDetails extends CommonBase { */ public long get_inbound_capacity_msat() { long ret = bindings.ChannelDetails_get_inbound_capacity_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, who's balance is not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new inbound HTLCs). * Note that there are some corner cases not fully handled here, so the actual available * inbound capacity may be slightly higher than this. @@ -231,6 +297,8 @@ public class ChannelDetails extends CommonBase { */ public void set_inbound_capacity_msat(long val) { bindings.ChannelDetails_set_inbound_capacity_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -248,6 +316,7 @@ public class ChannelDetails extends CommonBase { */ public Option_u32Z get_confirmations_required() { long ret = bindings.ChannelDetails_get_confirmations_required(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -269,6 +338,8 @@ public class ChannelDetails extends CommonBase { */ public void set_confirmations_required(Option_u32Z val) { bindings.ChannelDetails_set_confirmations_required(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -282,6 +353,7 @@ public class ChannelDetails extends CommonBase { */ public Option_u16Z get_force_close_spend_delay() { long ret = bindings.ChannelDetails_get_force_close_spend_delay(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -299,6 +371,8 @@ public class ChannelDetails extends CommonBase { */ public void set_force_close_spend_delay(Option_u16Z val) { bindings.ChannelDetails_set_force_close_spend_delay(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -306,6 +380,7 @@ public class ChannelDetails extends CommonBase { */ public boolean get_is_outbound() { boolean ret = bindings.ChannelDetails_get_is_outbound(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -314,6 +389,8 @@ public class ChannelDetails extends CommonBase { */ public void set_is_outbound(boolean val) { bindings.ChannelDetails_set_is_outbound(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -327,6 +404,7 @@ public class ChannelDetails extends CommonBase { */ public boolean get_is_funding_locked() { boolean ret = bindings.ChannelDetails_get_is_funding_locked(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -341,6 +419,8 @@ public class ChannelDetails extends CommonBase { */ public void set_is_funding_locked(boolean val) { bindings.ChannelDetails_set_is_funding_locked(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -351,6 +431,7 @@ public class ChannelDetails extends CommonBase { */ public boolean get_is_usable() { boolean ret = bindings.ChannelDetails_get_is_usable(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -362,6 +443,8 @@ public class ChannelDetails extends CommonBase { */ public void set_is_usable(boolean val) { bindings.ChannelDetails_set_is_usable(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -369,6 +452,7 @@ public class ChannelDetails extends CommonBase { */ public boolean get_is_public() { boolean ret = bindings.ChannelDetails_get_is_public(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -377,13 +461,31 @@ public class ChannelDetails extends CommonBase { */ public void set_is_public(boolean val) { bindings.ChannelDetails_set_is_public(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * Constructs a new ChannelDetails given each field */ - public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) { - long ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, short_channel_id_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + public static ChannelDetails of(byte[] channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, long channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, long user_channel_id_arg, long balance_msat_arg, long outbound_capacity_msat_arg, long inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) { + long ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, short_channel_id_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(counterparty_arg); + Reference.reachabilityFence(funding_txo_arg); + Reference.reachabilityFence(short_channel_id_arg); + Reference.reachabilityFence(channel_value_satoshis_arg); + Reference.reachabilityFence(unspendable_punishment_reserve_arg); + Reference.reachabilityFence(user_channel_id_arg); + Reference.reachabilityFence(balance_msat_arg); + Reference.reachabilityFence(outbound_capacity_msat_arg); + Reference.reachabilityFence(inbound_capacity_msat_arg); + Reference.reachabilityFence(confirmations_required_arg); + Reference.reachabilityFence(force_close_spend_delay_arg); + Reference.reachabilityFence(is_outbound_arg); + Reference.reachabilityFence(is_funding_locked_arg); + Reference.reachabilityFence(is_usable_arg); + Reference.reachabilityFence(is_public_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelDetails(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -392,6 +494,7 @@ public class ChannelDetails extends CommonBase { long clone_ptr() { long ret = bindings.ChannelDetails_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -400,6 +503,7 @@ public class ChannelDetails extends CommonBase { */ public ChannelDetails clone() { long ret = bindings.ChannelDetails_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelDetails(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChannelFeatures.java b/src/main/java/org/ldk/structs/ChannelFeatures.java index 40add60c..609de36d 100644 --- a/src/main/java/org/ldk/structs/ChannelFeatures.java +++ b/src/main/java/org/ldk/structs/ChannelFeatures.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,12 +27,19 @@ public class ChannelFeatures extends CommonBase { */ public boolean eq(ChannelFeatures b) { boolean ret = bindings.ChannelFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof ChannelFeatures)) return false; + return this.eq((ChannelFeatures)o); + } long clone_ptr() { long ret = bindings.ChannelFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -40,6 +48,7 @@ public class ChannelFeatures extends CommonBase { */ public ChannelFeatures clone() { long ret = bindings.ChannelFeatures_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -74,6 +83,7 @@ public class ChannelFeatures extends CommonBase { */ public boolean requires_unknown_bits() { boolean ret = bindings.ChannelFeatures_requires_unknown_bits(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -82,6 +92,7 @@ public class ChannelFeatures extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelFeatures_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -90,6 +101,7 @@ public class ChannelFeatures extends CommonBase { */ public static Result_ChannelFeaturesDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelFeatures_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java index 1e487f87..9f42abad 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeConfig.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -30,6 +31,7 @@ public class ChannelHandshakeConfig extends CommonBase { */ public int get_minimum_depth() { int ret = bindings.ChannelHandshakeConfig_get_minimum_depth(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -42,6 +44,8 @@ public class ChannelHandshakeConfig extends CommonBase { */ public void set_minimum_depth(int val) { bindings.ChannelHandshakeConfig_set_minimum_depth(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -63,6 +67,7 @@ public class ChannelHandshakeConfig extends CommonBase { */ public short get_our_to_self_delay() { short ret = bindings.ChannelHandshakeConfig_get_our_to_self_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -85,6 +90,8 @@ public class ChannelHandshakeConfig extends CommonBase { */ public void set_our_to_self_delay(short val) { bindings.ChannelHandshakeConfig_set_our_to_self_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -98,6 +105,7 @@ public class ChannelHandshakeConfig extends CommonBase { */ public long get_our_htlc_minimum_msat() { long ret = bindings.ChannelHandshakeConfig_get_our_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -112,6 +120,8 @@ public class ChannelHandshakeConfig extends CommonBase { */ public void set_our_htlc_minimum_msat(long val) { bindings.ChannelHandshakeConfig_set_our_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -119,6 +129,9 @@ public class ChannelHandshakeConfig extends CommonBase { */ public static ChannelHandshakeConfig of(int minimum_depth_arg, short our_to_self_delay_arg, long our_htlc_minimum_msat_arg) { long ret = bindings.ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg); + Reference.reachabilityFence(minimum_depth_arg); + Reference.reachabilityFence(our_to_self_delay_arg); + Reference.reachabilityFence(our_htlc_minimum_msat_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -127,6 +140,7 @@ public class ChannelHandshakeConfig extends CommonBase { long clone_ptr() { long ret = bindings.ChannelHandshakeConfig_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -135,6 +149,7 @@ public class ChannelHandshakeConfig extends CommonBase { */ public ChannelHandshakeConfig clone() { long ret = bindings.ChannelHandshakeConfig_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java b/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java index 3b16709b..ff9262de 100644 --- a/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java +++ b/src/main/java/org/ldk/structs/ChannelHandshakeLimits.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -37,6 +38,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public long get_min_funding_satoshis() { long ret = bindings.ChannelHandshakeLimits_get_min_funding_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -48,6 +50,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_min_funding_satoshis(long val) { bindings.ChannelHandshakeLimits_set_min_funding_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -58,6 +62,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public long get_max_htlc_minimum_msat() { long ret = bindings.ChannelHandshakeLimits_get_max_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -69,6 +74,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_max_htlc_minimum_msat(long val) { bindings.ChannelHandshakeLimits_set_max_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -79,6 +86,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public long get_min_max_htlc_value_in_flight_msat() { long ret = bindings.ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -90,6 +98,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_min_max_htlc_value_in_flight_msat(long val) { bindings.ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -101,6 +111,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public long get_max_channel_reserve_satoshis() { long ret = bindings.ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -113,6 +124,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_max_channel_reserve_satoshis(long val) { bindings.ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -123,6 +136,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public short get_min_max_accepted_htlcs() { short ret = bindings.ChannelHandshakeLimits_get_min_max_accepted_htlcs(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -134,6 +148,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_min_max_accepted_htlcs(short val) { bindings.ChannelHandshakeLimits_set_min_max_accepted_htlcs(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -146,6 +162,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public int get_max_minimum_depth() { int ret = bindings.ChannelHandshakeLimits_get_max_minimum_depth(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -159,6 +176,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_max_minimum_depth(int val) { bindings.ChannelHandshakeLimits_set_max_minimum_depth(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -173,6 +192,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public boolean get_force_announced_channel_preference() { boolean ret = bindings.ChannelHandshakeLimits_get_force_announced_channel_preference(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -188,6 +208,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_force_announced_channel_preference(boolean val) { bindings.ChannelHandshakeLimits_set_force_announced_channel_preference(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -201,6 +223,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public short get_their_to_self_delay() { short ret = bindings.ChannelHandshakeLimits_get_their_to_self_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -215,6 +238,8 @@ public class ChannelHandshakeLimits extends CommonBase { */ public void set_their_to_self_delay(short val) { bindings.ChannelHandshakeLimits_set_their_to_self_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -222,6 +247,14 @@ public class ChannelHandshakeLimits extends CommonBase { */ public static ChannelHandshakeLimits of(long min_funding_satoshis_arg, long max_htlc_minimum_msat_arg, long min_max_htlc_value_in_flight_msat_arg, long max_channel_reserve_satoshis_arg, short min_max_accepted_htlcs_arg, int max_minimum_depth_arg, boolean force_announced_channel_preference_arg, short their_to_self_delay_arg) { long ret = bindings.ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg); + Reference.reachabilityFence(min_funding_satoshis_arg); + Reference.reachabilityFence(max_htlc_minimum_msat_arg); + Reference.reachabilityFence(min_max_htlc_value_in_flight_msat_arg); + Reference.reachabilityFence(max_channel_reserve_satoshis_arg); + Reference.reachabilityFence(min_max_accepted_htlcs_arg); + Reference.reachabilityFence(max_minimum_depth_arg); + Reference.reachabilityFence(force_announced_channel_preference_arg); + Reference.reachabilityFence(their_to_self_delay_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeLimits(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -230,6 +263,7 @@ public class ChannelHandshakeLimits extends CommonBase { long clone_ptr() { long ret = bindings.ChannelHandshakeLimits_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -238,6 +272,7 @@ public class ChannelHandshakeLimits extends CommonBase { */ public ChannelHandshakeLimits clone() { long ret = bindings.ChannelHandshakeLimits_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeLimits(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChannelInfo.java b/src/main/java/org/ldk/structs/ChannelInfo.java index 61b4bce3..c9de83bc 100644 --- a/src/main/java/org/ldk/structs/ChannelInfo.java +++ b/src/main/java/org/ldk/structs/ChannelInfo.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class ChannelInfo extends CommonBase { */ public ChannelFeatures get_features() { long ret = bindings.ChannelInfo_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -36,6 +38,8 @@ public class ChannelInfo extends CommonBase { */ public void set_features(ChannelFeatures val) { bindings.ChannelInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,7 @@ public class ChannelInfo extends CommonBase { */ public NodeId get_node_one() { long ret = bindings.ChannelInfo_get_node_one(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -54,6 +59,8 @@ public class ChannelInfo extends CommonBase { */ public void set_node_one(NodeId val) { bindings.ChannelInfo_set_node_one(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -64,6 +71,7 @@ public class ChannelInfo extends CommonBase { @Nullable public DirectionalChannelInfo get_one_to_two() { long ret = bindings.ChannelInfo_get_one_to_two(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -77,6 +85,8 @@ public class ChannelInfo extends CommonBase { */ public void set_one_to_two(@Nullable DirectionalChannelInfo val) { bindings.ChannelInfo_set_one_to_two(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +94,7 @@ public class ChannelInfo extends CommonBase { */ public NodeId get_node_two() { long ret = bindings.ChannelInfo_get_node_two(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -95,6 +106,8 @@ public class ChannelInfo extends CommonBase { */ public void set_node_two(NodeId val) { bindings.ChannelInfo_set_node_two(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -105,6 +118,7 @@ public class ChannelInfo extends CommonBase { @Nullable public DirectionalChannelInfo get_two_to_one() { long ret = bindings.ChannelInfo_get_two_to_one(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -118,6 +132,8 @@ public class ChannelInfo extends CommonBase { */ public void set_two_to_one(@Nullable DirectionalChannelInfo val) { bindings.ChannelInfo_set_two_to_one(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -125,6 +141,7 @@ public class ChannelInfo extends CommonBase { */ public Option_u64Z get_capacity_sats() { long ret = bindings.ChannelInfo_get_capacity_sats(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -136,6 +153,8 @@ public class ChannelInfo extends CommonBase { */ public void set_capacity_sats(Option_u64Z val) { bindings.ChannelInfo_set_capacity_sats(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -149,6 +168,7 @@ public class ChannelInfo extends CommonBase { @Nullable public ChannelAnnouncement get_announcement_message() { long ret = bindings.ChannelInfo_get_announcement_message(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -165,21 +185,13 @@ public class ChannelInfo extends CommonBase { */ public void set_announcement_message(@Nullable ChannelAnnouncement val) { bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1); - } - - /** - * Constructs a new ChannelInfo given each field - */ - public static ChannelInfo of(ChannelFeatures features_arg, NodeId node_one_arg, DirectionalChannelInfo one_to_two_arg, NodeId node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) { - long ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg == null ? 0 : node_one_arg.ptr & ~1, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg == null ? 0 : node_two_arg.ptr & ~1, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); - if (ret >= 0 && ret <= 4096) { return null; } - ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelInfo(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.ChannelInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -188,6 +200,7 @@ public class ChannelInfo extends CommonBase { */ public ChannelInfo clone() { long ret = bindings.ChannelInfo_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -199,6 +212,7 @@ public class ChannelInfo extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelInfo_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -207,6 +221,7 @@ public class ChannelInfo extends CommonBase { */ public static Result_ChannelInfoDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelInfo_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelManager.java b/src/main/java/org/ldk/structs/ChannelManager.java index 9ec3a287..ab642c44 100644 --- a/src/main/java/org/ldk/structs/ChannelManager.java +++ b/src/main/java/org/ldk/structs/ChannelManager.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -70,6 +71,13 @@ public class ChannelManager extends CommonBase { */ public static ChannelManager of(FeeEstimator fee_est, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, KeysInterface keys_manager, UserConfig config, ChainParameters params) { long ret = bindings.ChannelManager_new(fee_est == null ? 0 : fee_est.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, keys_manager == null ? 0 : keys_manager.ptr, config == null ? 0 : config.ptr & ~1, params == null ? 0 : params.ptr & ~1); + Reference.reachabilityFence(fee_est); + Reference.reachabilityFence(chain_monitor); + Reference.reachabilityFence(tx_broadcaster); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(config); + Reference.reachabilityFence(params); if (ret >= 0 && ret <= 4096) { return null; } ChannelManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelManager(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -86,6 +94,7 @@ public class ChannelManager extends CommonBase { */ public UserConfig get_current_default_configuration() { long ret = bindings.ChannelManager_get_current_default_configuration(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UserConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -124,6 +133,12 @@ public class ChannelManager extends CommonBase { */ public Result__u832APIErrorZ create_channel(byte[] their_network_key, long channel_value_satoshis, long push_msat, long user_channel_id, @Nullable UserConfig override_config) { long ret = bindings.ChannelManager_create_channel(this.ptr, InternalUtils.check_arr_len(their_network_key, 33), channel_value_satoshis, push_msat, user_channel_id, override_config == null ? 0 : override_config.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_network_key); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(push_msat); + Reference.reachabilityFence(user_channel_id); + Reference.reachabilityFence(override_config); if (ret >= 0 && ret <= 4096) { return null; } Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -135,6 +150,7 @@ public class ChannelManager extends CommonBase { */ public ChannelDetails[] list_channels() { long[] ret = bindings.ChannelManager_list_channels(this.ptr); + Reference.reachabilityFence(this); ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { long ret_conv_16 = ret[q]; @@ -155,6 +171,7 @@ public class ChannelManager extends CommonBase { */ public ChannelDetails[] list_usable_channels() { long[] ret = bindings.ChannelManager_list_usable_channels(this.ptr); + Reference.reachabilityFence(this); ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { long ret_conv_16 = ret[q]; @@ -186,6 +203,8 @@ public class ChannelManager extends CommonBase { */ public Result_NoneAPIErrorZ close_channel(byte[] channel_id) { long ret = bindings.ChannelManager_close_channel(this.ptr, InternalUtils.check_arr_len(channel_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -214,6 +233,9 @@ public class ChannelManager extends CommonBase { */ public Result_NoneAPIErrorZ close_channel_with_target_feerate(byte[] channel_id, int target_feerate_sats_per_1000_weight) { long ret = bindings.ChannelManager_close_channel_with_target_feerate(this.ptr, InternalUtils.check_arr_len(channel_id, 32), target_feerate_sats_per_1000_weight); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_id); + Reference.reachabilityFence(target_feerate_sats_per_1000_weight); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -225,6 +247,8 @@ public class ChannelManager extends CommonBase { */ public Result_NoneAPIErrorZ force_close_channel(byte[] channel_id) { long ret = bindings.ChannelManager_force_close_channel(this.ptr, InternalUtils.check_arr_len(channel_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -236,6 +260,7 @@ public class ChannelManager extends CommonBase { */ public void force_close_all_channels() { bindings.ChannelManager_force_close_all_channels(this.ptr); + Reference.reachabilityFence(this); } /** @@ -283,6 +308,10 @@ public class ChannelManager extends CommonBase { */ public Result_PaymentIdPaymentSendFailureZ send_payment(Route route, byte[] payment_hash, @Nullable byte[] payment_secret) { long ret = bindings.ChannelManager_send_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(payment_secret); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); @@ -294,19 +323,46 @@ public class ChannelManager extends CommonBase { * * Errors returned are a superset of those returned from [`send_payment`], so see * [`send_payment`] documentation for more details on errors. This method will also error if the - * retry amount puts the payment more than 10% over the payment's total amount, or if the payment - * for the given `payment_id` cannot be found (likely due to timeout or success). + * retry amount puts the payment more than 10% over the payment's total amount, if the payment + * for the given `payment_id` cannot be found (likely due to timeout or success), or if + * further retries have been disabled with [`abandon_payment`]. * * [`send_payment`]: [`ChannelManager::send_payment`] + * [`abandon_payment`]: [`ChannelManager::abandon_payment`] */ public Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id) { long ret = bindings.ChannelManager_retry_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); return ret_hu_conv; } + /** + * Signals that no further retries for the given payment will occur. + * + * After this method returns, any future calls to [`retry_payment`] for the given `payment_id` + * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated, + * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining + * pending HTLCs for this payment. + * + * Note that calling this method does *not* prevent a payment from succeeding. You must still + * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to + * determine the ultimate status of a payment. + * + * [`retry_payment`]: Self::retry_payment + * [`Event::PaymentFailed`]: events::Event::PaymentFailed + * [`Event::PaymentSent`]: events::Event::PaymentSent + */ + public void abandon_payment(byte[] payment_id) { + bindings.ChannelManager_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_id); + } + /** * Send a spontaneous payment, which is a payment that does not require the recipient to have * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify @@ -327,6 +383,9 @@ public class ChannelManager extends CommonBase { */ public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_spontaneous_payment(Route route, @Nullable byte[] payment_preimage) { long ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_preimage, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_preimage); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); @@ -339,7 +398,8 @@ public class ChannelManager extends CommonBase { * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. * - * Panics if a funding transaction has already been provided for this channel. + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. * * May panic if the output found in the funding transaction is duplicative with some other * channel (note that this should be trivially prevented by using unique funding transaction @@ -354,9 +414,13 @@ public class ChannelManager extends CommonBase { * create a new channel with a conflicting funding transaction. * * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed */ public Result_NoneAPIErrorZ funding_transaction_generated(byte[] temporary_channel_id, byte[] funding_transaction) { long ret = bindings.ChannelManager_funding_transaction_generated(this.ptr, InternalUtils.check_arr_len(temporary_channel_id, 32), funding_transaction); + Reference.reachabilityFence(this); + Reference.reachabilityFence(temporary_channel_id); + Reference.reachabilityFence(funding_transaction); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -384,6 +448,10 @@ public class ChannelManager extends CommonBase { */ public void broadcast_node_announcement(byte[] rgb, byte[] alias, NetAddress[] addresses) { bindings.ChannelManager_broadcast_node_announcement(this.ptr, InternalUtils.check_arr_len(rgb, 3), InternalUtils.check_arr_len(alias, 32), addresses != null ? Arrays.stream(addresses).mapToLong(addresses_conv_12 -> addresses_conv_12.ptr).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(rgb); + Reference.reachabilityFence(alias); + Reference.reachabilityFence(addresses); } /** @@ -394,6 +462,7 @@ public class ChannelManager extends CommonBase { */ public void process_pending_htlc_forwards() { bindings.ChannelManager_process_pending_htlc_forwards(this.ptr); + Reference.reachabilityFence(this); } /** @@ -410,6 +479,7 @@ public class ChannelManager extends CommonBase { */ public void timer_tick_occurred() { bindings.ChannelManager_timer_tick_occurred(this.ptr); + Reference.reachabilityFence(this); } /** @@ -421,26 +491,32 @@ public class ChannelManager extends CommonBase { */ public boolean fail_htlc_backwards(byte[] payment_hash) { boolean ret = bindings.ChannelManager_fail_htlc_backwards(this.ptr, InternalUtils.check_arr_len(payment_hash, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_hash); return ret; } /** - * Provides a payment preimage in response to a PaymentReceived event, returning true and - * generating message events for the net layer to claim the payment, if possible. Thus, you - * should probably kick the net layer to go send messages if this returns true! + * Provides a payment preimage in response to [`Event::PaymentReceived`], generating any + * [`MessageSendEvent`]s needed to claim the payment. * * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentReceived` * event matches your expectation. If you fail to do so and call this method, you may provide * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * - * May panic if called except in response to a PaymentReceived event. + * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now + * pending for processing via [`get_and_clear_pending_msg_events`]. * + * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ public boolean claim_funds(byte[] payment_preimage) { boolean ret = bindings.ChannelManager_claim_funds(this.ptr, InternalUtils.check_arr_len(payment_preimage, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_preimage); return ret; } @@ -449,6 +525,7 @@ public class ChannelManager extends CommonBase { */ public byte[] get_our_node_id() { byte[] ret = bindings.ChannelManager_get_our_node_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -457,7 +534,7 @@ public class ChannelManager extends CommonBase { * to pay us. * * This differs from [`create_inbound_payment_for_hash`] only in that it generates the - * [`PaymentHash`] and [`PaymentPreimage`] for you, returning the first and storing the second. + * [`PaymentHash`] and [`PaymentPreimage`] for you. * * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be @@ -465,16 +542,47 @@ public class ChannelManager extends CommonBase { * * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * * [`claim_funds`]: Self::claim_funds * [`PaymentReceived`]: events::Event::PaymentReceived * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ - public TwoTuple_PaymentHashPaymentSecretZ create_inbound_payment(Option_u64Z min_value_msat, int invoice_expiry_delta_secs, long user_payment_id) { - long ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, user_payment_id); + public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(Option_u64Z min_value_msat, int invoice_expiry_delta_secs) { + long ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs); + Reference.reachabilityFence(this); + Reference.reachabilityFence(min_value_msat); + Reference.reachabilityFence(invoice_expiry_delta_secs); if (ret >= 0 && ret <= 4096) { return null; } - TwoTuple_PaymentHashPaymentSecretZ ret_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, ret); - ret_hu_conv.ptrs_to.add(this); + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Legacy version of [`create_inbound_payment`]. Use this method if you wish to share + * serialized state with LDK node(s) running 0.0.103 and earlier. + * + * # Note + * This method is deprecated and will be removed soon. + * + * [`create_inbound_payment`]: Self::create_inbound_payment + */ + public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ create_inbound_payment_legacy(Option_u64Z min_value_msat, int invoice_expiry_delta_secs) { + long ret = bindings.ChannelManager_create_inbound_payment_legacy(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs); + Reference.reachabilityFence(this); + Reference.reachabilityFence(min_value_msat); + Reference.reachabilityFence(invoice_expiry_delta_secs); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; } @@ -486,14 +594,9 @@ public class ChannelManager extends CommonBase { * payment secret fetched via this method or [`create_inbound_payment`], and which is at least * the `min_value_msat` provided here, if one is provided. * - * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) must be globally unique. This - * method may return an Err if another payment with the same payment_hash is still pending. - * - * `user_payment_id` will be provided back in [`PaymentPurpose::InvoicePayment::user_payment_id`] events to - * allow tracking of which events correspond with which calls to this and - * [`create_inbound_payment`]. `user_payment_id` has no meaning inside of LDK, it is simply - * copied to events and otherwise ignored. It may be used to correlate PaymentReceived events - * with invoice metadata stored elsewhere. + * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though + * note that LDK will not stop you from registering duplicate payment hashes for inbound + * payments. * * `min_value_msat` should be set if the invoice being generated contains a value. Any payment * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` @@ -512,32 +615,78 @@ public class ChannelManager extends CommonBase { * If you need exact expiry semantics, you should enforce them upon receipt of * [`PaymentReceived`]. * - * Pending inbound payments are stored in memory and in serialized versions of this - * [`ChannelManager`]. If potentially unbounded numbers of inbound payments may exist and - * space is limited, you may wish to rate-limit inbound payment creation. - * * May panic if `invoice_expiry_delta_secs` is greater than one year. * * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * * [`create_inbound_payment`]: Self::create_inbound_payment * [`PaymentReceived`]: events::Event::PaymentReceived - * [`PaymentPurpose::InvoicePayment::user_payment_id`]: events::PaymentPurpose::InvoicePayment::user_payment_id */ - public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash(byte[] payment_hash, Option_u64Z min_value_msat, int invoice_expiry_delta_secs, long user_payment_id) { - long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs, user_payment_id); + public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(byte[] payment_hash, Option_u64Z min_value_msat, int invoice_expiry_delta_secs) { + long ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(min_value_msat); + Reference.reachabilityFence(invoice_expiry_delta_secs); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Legacy version of [`create_inbound_payment_for_hash`]. Use this method if you wish to share + * serialized state with LDK node(s) running 0.0.103 and earlier. + * + * # Note + * This method is deprecated and will be removed soon. + * + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + */ + public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash_legacy(byte[] payment_hash, Option_u64Z min_value_msat, int invoice_expiry_delta_secs) { + long ret = bindings.ChannelManager_create_inbound_payment_for_hash_legacy(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(min_value_msat); + Reference.reachabilityFence(invoice_expiry_delta_secs); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; } + /** + * Gets an LDK-generated payment preimage from a payment hash and payment secret that were + * previously returned from [`create_inbound_payment`]. + * + * [`create_inbound_payment`]: Self::create_inbound_payment + */ + public Result_PaymentPreimageAPIErrorZ get_payment_preimage(byte[] payment_hash, byte[] payment_secret) { + long ret = bindings.ChannelManager_get_payment_preimage(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(payment_secret); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ public MessageSendEventsProvider as_MessageSendEventsProvider() { long ret = bindings.ChannelManager_as_MessageSendEventsProvider(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -550,6 +699,7 @@ public class ChannelManager extends CommonBase { */ public EventsProvider as_EventsProvider() { long ret = bindings.ChannelManager_as_EventsProvider(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } EventsProvider ret_hu_conv = new EventsProvider(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -562,6 +712,7 @@ public class ChannelManager extends CommonBase { */ public Listen as_Listen() { long ret = bindings.ChannelManager_as_Listen(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Listen ret_hu_conv = new Listen(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -574,6 +725,7 @@ public class ChannelManager extends CommonBase { */ public Confirm as_Confirm() { long ret = bindings.ChannelManager_as_Confirm(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Confirm ret_hu_conv = new Confirm(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -585,10 +737,13 @@ public class ChannelManager extends CommonBase { * indicating whether persistence is necessary. Only one listener on * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken * up. - * Note that the feature `allow_wallclock_use` must be enabled to use this function. + * + * Note that this method is not available with the `no-std` feature. */ public boolean await_persistable_update_timeout(long max_wait) { boolean ret = bindings.ChannelManager_await_persistable_update_timeout(this.ptr, max_wait); + Reference.reachabilityFence(this); + Reference.reachabilityFence(max_wait); return ret; } @@ -599,6 +754,7 @@ public class ChannelManager extends CommonBase { */ public void await_persistable_update() { bindings.ChannelManager_await_persistable_update(this.ptr); + Reference.reachabilityFence(this); } /** @@ -607,6 +763,7 @@ public class ChannelManager extends CommonBase { */ public BestBlock current_best_block() { long ret = bindings.ChannelManager_current_best_block(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -619,6 +776,7 @@ public class ChannelManager extends CommonBase { */ public ChannelMessageHandler as_ChannelMessageHandler() { long ret = bindings.ChannelManager_as_ChannelMessageHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelMessageHandler ret_hu_conv = new ChannelMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -630,6 +788,7 @@ public class ChannelManager extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelManager_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -639,6 +798,7 @@ public class ChannelManager extends CommonBase { */ public Payer as_Payer() { long ret = bindings.ChannelManager_as_Payer(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Payer ret_hu_conv = new Payer(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ChannelManagerPersister.java b/src/main/java/org/ldk/structs/ChannelManagerPersister.java index c27ea3ef..686a076e 100644 --- a/src/main/java/org/ldk/structs/ChannelManagerPersister.java +++ b/src/main/java/org/ldk/structs/ChannelManagerPersister.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -55,6 +56,8 @@ public class ChannelManagerPersister extends CommonBase { */ public Result_NoneErrorZ persist_manager(ChannelManager channel_manager) { long ret = bindings.ChannelManagerPersister_persist_manager(this.ptr, channel_manager == null ? 0 : channel_manager.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_manager); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); this.ptrs_to.add(channel_manager); diff --git a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java index 2d628226..a0a628e8 100644 --- a/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java +++ b/src/main/java/org/ldk/structs/ChannelManagerReadArgs.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -57,6 +58,7 @@ public class ChannelManagerReadArgs extends CommonBase { */ public KeysInterface get_keys_manager() { long ret = bindings.ChannelManagerReadArgs_get_keys_manager(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } KeysInterface ret_hu_conv = new KeysInterface(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -70,6 +72,8 @@ public class ChannelManagerReadArgs extends CommonBase { */ public void set_keys_manager(KeysInterface val) { bindings.ChannelManagerReadArgs_set_keys_manager(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -80,6 +84,7 @@ public class ChannelManagerReadArgs extends CommonBase { */ public FeeEstimator get_fee_estimator() { long ret = bindings.ChannelManagerReadArgs_get_fee_estimator(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } FeeEstimator ret_hu_conv = new FeeEstimator(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -93,6 +98,8 @@ public class ChannelManagerReadArgs extends CommonBase { */ public void set_fee_estimator(FeeEstimator val) { bindings.ChannelManagerReadArgs_set_fee_estimator(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -105,6 +112,7 @@ public class ChannelManagerReadArgs extends CommonBase { */ public Watch get_chain_monitor() { long ret = bindings.ChannelManagerReadArgs_get_chain_monitor(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Watch ret_hu_conv = new Watch(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -120,6 +128,8 @@ public class ChannelManagerReadArgs extends CommonBase { */ public void set_chain_monitor(Watch val) { bindings.ChannelManagerReadArgs_set_chain_monitor(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -130,6 +140,7 @@ public class ChannelManagerReadArgs extends CommonBase { */ public BroadcasterInterface get_tx_broadcaster() { long ret = bindings.ChannelManagerReadArgs_get_tx_broadcaster(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BroadcasterInterface ret_hu_conv = new BroadcasterInterface(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -143,6 +154,8 @@ public class ChannelManagerReadArgs extends CommonBase { */ public void set_tx_broadcaster(BroadcasterInterface val) { bindings.ChannelManagerReadArgs_set_tx_broadcaster(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -152,6 +165,7 @@ public class ChannelManagerReadArgs extends CommonBase { */ public Logger get_logger() { long ret = bindings.ChannelManagerReadArgs_get_logger(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Logger ret_hu_conv = new Logger(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -164,6 +178,8 @@ public class ChannelManagerReadArgs extends CommonBase { */ public void set_logger(Logger val) { bindings.ChannelManagerReadArgs_set_logger(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -173,6 +189,7 @@ public class ChannelManagerReadArgs extends CommonBase { */ public UserConfig get_default_config() { long ret = bindings.ChannelManagerReadArgs_get_default_config(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UserConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -185,6 +202,8 @@ public class ChannelManagerReadArgs extends CommonBase { */ public void set_default_config(UserConfig val) { bindings.ChannelManagerReadArgs_set_default_config(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -194,6 +213,13 @@ public class ChannelManagerReadArgs extends CommonBase { */ public static ChannelManagerReadArgs of(KeysInterface keys_manager, FeeEstimator fee_estimator, Watch chain_monitor, BroadcasterInterface tx_broadcaster, Logger logger, UserConfig default_config, ChannelMonitor[] channel_monitors) { long ret = bindings.ChannelManagerReadArgs_new(keys_manager == null ? 0 : keys_manager.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, chain_monitor == null ? 0 : chain_monitor.ptr, tx_broadcaster == null ? 0 : tx_broadcaster.ptr, logger == null ? 0 : logger.ptr, default_config == null ? 0 : default_config.ptr & ~1, channel_monitors != null ? Arrays.stream(channel_monitors).mapToLong(channel_monitors_conv_16 -> channel_monitors_conv_16 == null ? 0 : channel_monitors_conv_16.ptr & ~1).toArray() : null); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(chain_monitor); + Reference.reachabilityFence(tx_broadcaster); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(default_config); + Reference.reachabilityFence(channel_monitors); if (ret >= 0 && ret <= 4096) { return null; } ChannelManagerReadArgs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelManagerReadArgs(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/ChannelMessageHandler.java b/src/main/java/org/ldk/structs/ChannelMessageHandler.java index f4546bd4..8bb6667f 100644 --- a/src/main/java/org/ldk/structs/ChannelMessageHandler.java +++ b/src/main/java/org/ldk/structs/ChannelMessageHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -218,6 +219,10 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_open_channel(byte[] their_node_id, InitFeatures their_features, OpenChannel msg) { bindings.ChannelMessageHandler_handle_open_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(their_features); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -226,6 +231,10 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_accept_channel(byte[] their_node_id, InitFeatures their_features, AcceptChannel msg) { bindings.ChannelMessageHandler_handle_accept_channel(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(their_features); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -234,6 +243,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_funding_created(byte[] their_node_id, FundingCreated msg) { bindings.ChannelMessageHandler_handle_funding_created(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -242,6 +254,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_funding_signed(byte[] their_node_id, FundingSigned msg) { bindings.ChannelMessageHandler_handle_funding_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -250,6 +265,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_funding_locked(byte[] their_node_id, FundingLocked msg) { bindings.ChannelMessageHandler_handle_funding_locked(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -258,6 +276,10 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_shutdown(byte[] their_node_id, InitFeatures their_features, Shutdown msg) { bindings.ChannelMessageHandler_handle_shutdown(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), their_features == null ? 0 : their_features.ptr & ~1, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(their_features); + Reference.reachabilityFence(msg); this.ptrs_to.add(their_features); this.ptrs_to.add(msg); } @@ -267,6 +289,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_closing_signed(byte[] their_node_id, ClosingSigned msg) { bindings.ChannelMessageHandler_handle_closing_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -275,6 +300,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_update_add_htlc(byte[] their_node_id, UpdateAddHTLC msg) { bindings.ChannelMessageHandler_handle_update_add_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -283,6 +311,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_update_fulfill_htlc(byte[] their_node_id, UpdateFulfillHTLC msg) { bindings.ChannelMessageHandler_handle_update_fulfill_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -291,6 +322,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_update_fail_htlc(byte[] their_node_id, UpdateFailHTLC msg) { bindings.ChannelMessageHandler_handle_update_fail_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -299,6 +333,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_update_fail_malformed_htlc(byte[] their_node_id, UpdateFailMalformedHTLC msg) { bindings.ChannelMessageHandler_handle_update_fail_malformed_htlc(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -307,6 +344,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_commitment_signed(byte[] their_node_id, CommitmentSigned msg) { bindings.ChannelMessageHandler_handle_commitment_signed(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -315,6 +355,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_revoke_and_ack(byte[] their_node_id, RevokeAndACK msg) { bindings.ChannelMessageHandler_handle_revoke_and_ack(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -323,6 +366,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_update_fee(byte[] their_node_id, UpdateFee msg) { bindings.ChannelMessageHandler_handle_update_fee(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -331,6 +377,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_announcement_signatures(byte[] their_node_id, AnnouncementSignatures msg) { bindings.ChannelMessageHandler_handle_announcement_signatures(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -342,6 +391,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) { bindings.ChannelMessageHandler_peer_disconnected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), no_connection_possible); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(no_connection_possible); } /** @@ -349,6 +401,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void peer_connected(byte[] their_node_id, Init msg) { bindings.ChannelMessageHandler_peer_connected(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -357,6 +412,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_channel_reestablish(byte[] their_node_id, ChannelReestablish msg) { bindings.ChannelMessageHandler_handle_channel_reestablish(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -365,6 +423,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_channel_update(byte[] their_node_id, ChannelUpdate msg) { bindings.ChannelMessageHandler_handle_channel_update(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } @@ -373,6 +434,9 @@ public class ChannelMessageHandler extends CommonBase { */ public void handle_error(byte[] their_node_id, ErrorMessage msg) { bindings.ChannelMessageHandler_handle_error(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); this.ptrs_to.add(msg); } diff --git a/src/main/java/org/ldk/structs/ChannelMonitor.java b/src/main/java/org/ldk/structs/ChannelMonitor.java index c9b5444e..6ebf105a 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitor.java +++ b/src/main/java/org/ldk/structs/ChannelMonitor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -36,6 +37,7 @@ public class ChannelMonitor extends CommonBase { long clone_ptr() { long ret = bindings.ChannelMonitor_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -44,6 +46,7 @@ public class ChannelMonitor extends CommonBase { */ public ChannelMonitor clone() { long ret = bindings.ChannelMonitor_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelMonitor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelMonitor(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -55,6 +58,7 @@ public class ChannelMonitor extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelMonitor_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -64,10 +68,15 @@ public class ChannelMonitor extends CommonBase { * * panics if the given update is not the next update by update_id. */ - public Result_NoneMonitorUpdateErrorZ update_monitor(ChannelMonitorUpdate updates, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { + public Result_NoneNoneZ update_monitor(ChannelMonitorUpdate updates, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { long ret = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0 : updates.ptr & ~1, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(updates); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); + Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); this.ptrs_to.add(updates); this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); @@ -81,6 +90,7 @@ public class ChannelMonitor extends CommonBase { */ public long get_latest_update_id() { long ret = bindings.ChannelMonitor_get_latest_update_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -89,6 +99,7 @@ public class ChannelMonitor extends CommonBase { */ public TwoTuple_OutPointScriptZ get_funding_txo() { long ret = bindings.ChannelMonitor_get_funding_txo(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_OutPointScriptZ ret_hu_conv = new TwoTuple_OutPointScriptZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -101,6 +112,7 @@ public class ChannelMonitor extends CommonBase { */ public TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ[] get_outputs_to_watch() { long[] ret = bindings.ChannelMonitor_get_outputs_to_watch(this.ptr); + Reference.reachabilityFence(this); TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ[] ret_conv_40_arr = new TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ[ret.length]; for (int o = 0; o < ret.length; o++) { long ret_conv_40 = ret[o]; @@ -118,6 +130,8 @@ public class ChannelMonitor extends CommonBase { */ public void load_outputs_to_watch(Filter filter) { bindings.ChannelMonitor_load_outputs_to_watch(this.ptr, filter == null ? 0 : filter.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(filter); this.ptrs_to.add(filter); } @@ -127,6 +141,7 @@ public class ChannelMonitor extends CommonBase { */ public MonitorEvent[] get_and_clear_pending_monitor_events() { long[] ret = bindings.ChannelMonitor_get_and_clear_pending_monitor_events(this.ptr); + Reference.reachabilityFence(this); MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { long ret_conv_14 = ret[o]; @@ -147,6 +162,7 @@ public class ChannelMonitor extends CommonBase { */ public Event[] get_and_clear_pending_events() { long[] ret = bindings.ChannelMonitor_get_and_clear_pending_events(this.ptr); + Reference.reachabilityFence(this); Event[] ret_conv_7_arr = new Event[ret.length]; for (int h = 0; h < ret.length; h++) { long ret_conv_7 = ret[h]; @@ -170,6 +186,8 @@ public class ChannelMonitor extends CommonBase { */ public byte[][] get_latest_holder_commitment_txn(Logger logger) { byte[][] ret = bindings.ChannelMonitor_get_latest_holder_commitment_txn(this.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(logger); this.ptrs_to.add(logger); return ret; } @@ -189,6 +207,13 @@ public class ChannelMonitor extends CommonBase { */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] block_connected(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { long[] ret = bindings.ChannelMonitor_block_connected(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(txdata); + Reference.reachabilityFence(height); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(logger); TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] ret_conv_39_arr = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[ret.length]; for (int n = 0; n < ret.length; n++) { long ret_conv_39 = ret[n]; @@ -208,6 +233,12 @@ public class ChannelMonitor extends CommonBase { */ public void block_disconnected(byte[] header, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { bindings.ChannelMonitor_block_disconnected(this.ptr, InternalUtils.check_arr_len(header, 80), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(height); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(logger); this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); this.ptrs_to.add(logger); @@ -224,6 +255,13 @@ public class ChannelMonitor extends CommonBase { */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] transactions_confirmed(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { long[] ret = bindings.ChannelMonitor_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(txdata); + Reference.reachabilityFence(height); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(logger); TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] ret_conv_39_arr = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[ret.length]; for (int n = 0; n < ret.length; n++) { long ret_conv_39 = ret[n]; @@ -247,6 +285,11 @@ public class ChannelMonitor extends CommonBase { */ public void transaction_unconfirmed(byte[] txid, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { bindings.ChannelMonitor_transaction_unconfirmed(this.ptr, InternalUtils.check_arr_len(txid, 32), broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(txid); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(logger); this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); this.ptrs_to.add(logger); @@ -263,6 +306,12 @@ public class ChannelMonitor extends CommonBase { */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] best_block_updated(byte[] header, int height, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { long[] ret = bindings.ChannelMonitor_best_block_updated(this.ptr, InternalUtils.check_arr_len(header, 80), height, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(height); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(fee_estimator); + Reference.reachabilityFence(logger); TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] ret_conv_39_arr = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[ret.length]; for (int n = 0; n < ret.length; n++) { long ret_conv_39 = ret[n]; @@ -281,6 +330,7 @@ public class ChannelMonitor extends CommonBase { */ public byte[][] get_relevant_txids() { byte[][] ret = bindings.ChannelMonitor_get_relevant_txids(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -290,6 +340,7 @@ public class ChannelMonitor extends CommonBase { */ public BestBlock current_best_block() { long ret = bindings.ChannelMonitor_current_best_block(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BestBlock(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -314,6 +365,7 @@ public class ChannelMonitor extends CommonBase { */ public Balance[] get_claimable_balances() { long[] ret = bindings.ChannelMonitor_get_claimable_balances(this.ptr); + Reference.reachabilityFence(this); Balance[] ret_conv_9_arr = new Balance[ret.length]; for (int j = 0; j < ret.length; j++) { long ret_conv_9 = ret[j]; diff --git a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java index 815b2632..c221d105 100644 --- a/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java +++ b/src/main/java/org/ldk/structs/ChannelMonitorUpdate.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -35,6 +36,7 @@ public class ChannelMonitorUpdate extends CommonBase { */ public long get_update_id() { long ret = bindings.ChannelMonitorUpdate_get_update_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,10 +55,13 @@ public class ChannelMonitorUpdate extends CommonBase { */ public void set_update_id(long val) { bindings.ChannelMonitorUpdate_set_update_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.ChannelMonitorUpdate_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -65,6 +70,7 @@ public class ChannelMonitorUpdate extends CommonBase { */ public ChannelMonitorUpdate clone() { long ret = bindings.ChannelMonitorUpdate_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelMonitorUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelMonitorUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -76,6 +82,7 @@ public class ChannelMonitorUpdate extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelMonitorUpdate_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -84,6 +91,7 @@ public class ChannelMonitorUpdate extends CommonBase { */ public static Result_ChannelMonitorUpdateDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelMonitorUpdate_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelPublicKeys.java b/src/main/java/org/ldk/structs/ChannelPublicKeys.java index fe4c4058..ce8eec40 100644 --- a/src/main/java/org/ldk/structs/ChannelPublicKeys.java +++ b/src/main/java/org/ldk/structs/ChannelPublicKeys.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class ChannelPublicKeys extends CommonBase { */ public byte[] get_funding_pubkey() { byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -34,6 +36,8 @@ public class ChannelPublicKeys extends CommonBase { */ public void set_funding_pubkey(byte[] val) { bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -44,6 +48,7 @@ public class ChannelPublicKeys extends CommonBase { */ public byte[] get_revocation_basepoint() { byte[] ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -55,6 +60,8 @@ public class ChannelPublicKeys extends CommonBase { */ public void set_revocation_basepoint(byte[] val) { bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -64,6 +71,7 @@ public class ChannelPublicKeys extends CommonBase { */ public byte[] get_payment_point() { byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -74,6 +82,8 @@ public class ChannelPublicKeys extends CommonBase { */ public void set_payment_point(byte[] val) { bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -83,6 +93,7 @@ public class ChannelPublicKeys extends CommonBase { */ public byte[] get_delayed_payment_basepoint() { byte[] ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -93,6 +104,8 @@ public class ChannelPublicKeys extends CommonBase { */ public void set_delayed_payment_basepoint(byte[] val) { bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -101,6 +114,7 @@ public class ChannelPublicKeys extends CommonBase { */ public byte[] get_htlc_basepoint() { byte[] ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -110,6 +124,8 @@ public class ChannelPublicKeys extends CommonBase { */ public void set_htlc_basepoint(byte[] val) { bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -117,6 +133,11 @@ public class ChannelPublicKeys extends CommonBase { */ public static ChannelPublicKeys of(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg) { long ret = bindings.ChannelPublicKeys_new(InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33)); + Reference.reachabilityFence(funding_pubkey_arg); + Reference.reachabilityFence(revocation_basepoint_arg); + Reference.reachabilityFence(payment_point_arg); + Reference.reachabilityFence(delayed_payment_basepoint_arg); + Reference.reachabilityFence(htlc_basepoint_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -125,6 +146,7 @@ public class ChannelPublicKeys extends CommonBase { long clone_ptr() { long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -133,6 +155,7 @@ public class ChannelPublicKeys extends CommonBase { */ public ChannelPublicKeys clone() { long ret = bindings.ChannelPublicKeys_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -144,6 +167,7 @@ public class ChannelPublicKeys extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelPublicKeys_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -152,6 +176,7 @@ public class ChannelPublicKeys extends CommonBase { */ public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelPublicKeys_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelReestablish.java b/src/main/java/org/ldk/structs/ChannelReestablish.java index 6e50f617..47f38226 100644 --- a/src/main/java/org/ldk/structs/ChannelReestablish.java +++ b/src/main/java/org/ldk/structs/ChannelReestablish.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ChannelReestablish extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.ChannelReestablish_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class ChannelReestablish extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.ChannelReestablish_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class ChannelReestablish extends CommonBase { */ public long get_next_local_commitment_number() { long ret = bindings.ChannelReestablish_get_next_local_commitment_number(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class ChannelReestablish extends CommonBase { */ public void set_next_local_commitment_number(long val) { bindings.ChannelReestablish_set_next_local_commitment_number(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class ChannelReestablish extends CommonBase { */ public long get_next_remote_commitment_number() { long ret = bindings.ChannelReestablish_get_next_remote_commitment_number(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,10 +70,13 @@ public class ChannelReestablish extends CommonBase { */ public void set_next_remote_commitment_number(long val) { bindings.ChannelReestablish_set_next_remote_commitment_number(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.ChannelReestablish_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -74,6 +85,7 @@ public class ChannelReestablish extends CommonBase { */ public ChannelReestablish clone() { long ret = bindings.ChannelReestablish_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelReestablish ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelReestablish(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -85,6 +97,7 @@ public class ChannelReestablish extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelReestablish_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -93,6 +106,7 @@ public class ChannelReestablish extends CommonBase { */ public static Result_ChannelReestablishDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelReestablish_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelTransactionParameters.java b/src/main/java/org/ldk/structs/ChannelTransactionParameters.java index 3835ee09..2bc34609 100644 --- a/src/main/java/org/ldk/structs/ChannelTransactionParameters.java +++ b/src/main/java/org/ldk/structs/ChannelTransactionParameters.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -28,6 +29,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public ChannelPublicKeys get_holder_pubkeys() { long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -39,6 +41,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_holder_pubkeys(ChannelPublicKeys val) { bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -46,6 +50,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public short get_holder_selected_contest_delay() { short ret = bindings.ChannelTransactionParameters_get_holder_selected_contest_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -54,6 +59,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_holder_selected_contest_delay(short val) { bindings.ChannelTransactionParameters_set_holder_selected_contest_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -62,6 +69,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public boolean get_is_outbound_from_holder() { boolean ret = bindings.ChannelTransactionParameters_get_is_outbound_from_holder(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -71,6 +79,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_is_outbound_from_holder(boolean val) { bindings.ChannelTransactionParameters_set_is_outbound_from_holder(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -82,6 +92,7 @@ public class ChannelTransactionParameters extends CommonBase { @Nullable public CounterpartyChannelTransactionParameters get_counterparty_parameters() { long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CounterpartyChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -96,6 +107,8 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_counterparty_parameters(@Nullable CounterpartyChannelTransactionParameters val) { bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -106,6 +119,7 @@ public class ChannelTransactionParameters extends CommonBase { @Nullable public OutPoint get_funding_outpoint() { long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -119,13 +133,39 @@ public class ChannelTransactionParameters extends CommonBase { */ public void set_funding_outpoint(@Nullable OutPoint val) { bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * Are anchors used for this channel. Boolean is serialization backwards-compatible + */ + public COption_NoneZ get_opt_anchors() { + COption_NoneZ ret = bindings.ChannelTransactionParameters_get_opt_anchors(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Are anchors used for this channel. Boolean is serialization backwards-compatible + */ + public void set_opt_anchors(org.ldk.enums.COption_NoneZ val) { + bindings.ChannelTransactionParameters_set_opt_anchors(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * Constructs a new ChannelTransactionParameters given each field */ - public static ChannelTransactionParameters of(ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg) { - long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1); + public static ChannelTransactionParameters of(ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg, org.ldk.enums.COption_NoneZ opt_anchors_arg) { + long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1, opt_anchors_arg); + Reference.reachabilityFence(holder_pubkeys_arg); + Reference.reachabilityFence(holder_selected_contest_delay_arg); + Reference.reachabilityFence(is_outbound_from_holder_arg); + Reference.reachabilityFence(counterparty_parameters_arg); + Reference.reachabilityFence(funding_outpoint_arg); + Reference.reachabilityFence(opt_anchors_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -134,6 +174,7 @@ public class ChannelTransactionParameters extends CommonBase { long clone_ptr() { long ret = bindings.ChannelTransactionParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -142,6 +183,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public ChannelTransactionParameters clone() { long ret = bindings.ChannelTransactionParameters_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -153,6 +195,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public boolean is_populated() { boolean ret = bindings.ChannelTransactionParameters_is_populated(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -164,6 +207,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public DirectedChannelTransactionParameters as_holder_broadcastable() { long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectedChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -178,6 +222,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public DirectedChannelTransactionParameters as_counterparty_broadcastable() { long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DirectedChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectedChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -189,6 +234,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelTransactionParameters_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -197,6 +243,7 @@ public class ChannelTransactionParameters extends CommonBase { */ public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelTransactionParameters_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ChannelTypeFeatures.java b/src/main/java/org/ldk/structs/ChannelTypeFeatures.java new file mode 100644 index 00000000..0dcfcf53 --- /dev/null +++ b/src/main/java/org/ldk/structs/ChannelTypeFeatures.java @@ -0,0 +1,119 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * Features used within the channel_type field in an OpenChannel message. + * + * A channel is always of some known \"type\", describing the transaction formats used and the exact + * semantics of our interaction with our peer. + * + * Note that because a channel is a specific type which is proposed by the opener and accepted by + * the counterparty, only required features are allowed here. + * + * This is serialized differently from other feature types - it is not prefixed by a length, and + * thus must only appear inside a TLV where its length is known in advance. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class ChannelTypeFeatures extends CommonBase { + ChannelTypeFeatures(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.ChannelTypeFeatures_free(ptr); } + } + + /** + * Checks if two ChannelTypeFeaturess contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + * Two objects with NULL inner values will be considered "equal" here. + */ + public boolean eq(ChannelTypeFeatures b) { + boolean ret = bindings.ChannelTypeFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); + this.ptrs_to.add(b); + return ret; + } + + @Override public boolean equals(Object o) { + if (!(o instanceof ChannelTypeFeatures)) return false; + return this.eq((ChannelTypeFeatures)o); + } + long clone_ptr() { + long ret = bindings.ChannelTypeFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a copy of the ChannelTypeFeatures + */ + public ChannelTypeFeatures clone() { + long ret = bindings.ChannelTypeFeatures_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Create a blank Features with no features set + */ + public static ChannelTypeFeatures empty() { + long ret = bindings.ChannelTypeFeatures_empty(); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Creates a Features with the bits set which are known by the implementation + */ + public static ChannelTypeFeatures known() { + long ret = bindings.ChannelTypeFeatures_known(); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ + public boolean requires_unknown_bits() { + boolean ret = bindings.ChannelTypeFeatures_requires_unknown_bits(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read + */ + public byte[] write() { + byte[] ret = bindings.ChannelTypeFeatures_write(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write + */ + public static Result_ChannelTypeFeaturesDecodeErrorZ read(byte[] ser) { + long ret = bindings.ChannelTypeFeatures_read(ser); + Reference.reachabilityFence(ser); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/ChannelUpdate.java b/src/main/java/org/ldk/structs/ChannelUpdate.java index 12f66e65..a4f68b96 100644 --- a/src/main/java/org/ldk/structs/ChannelUpdate.java +++ b/src/main/java/org/ldk/structs/ChannelUpdate.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ChannelUpdate extends CommonBase { */ public byte[] get_signature() { byte[] ret = bindings.ChannelUpdate_get_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class ChannelUpdate extends CommonBase { */ public void set_signature(byte[] val) { bindings.ChannelUpdate_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class ChannelUpdate extends CommonBase { */ public UnsignedChannelUpdate get_contents() { long ret = bindings.ChannelUpdate_get_contents(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -50,6 +55,8 @@ public class ChannelUpdate extends CommonBase { */ public void set_contents(UnsignedChannelUpdate val) { bindings.ChannelUpdate_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,8 @@ public class ChannelUpdate extends CommonBase { */ public static ChannelUpdate of(byte[] signature_arg, UnsignedChannelUpdate contents_arg) { long ret = bindings.ChannelUpdate_new(InternalUtils.check_arr_len(signature_arg, 64), contents_arg == null ? 0 : contents_arg.ptr & ~1); + Reference.reachabilityFence(signature_arg); + Reference.reachabilityFence(contents_arg); if (ret >= 0 && ret <= 4096) { return null; } ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -65,6 +74,7 @@ public class ChannelUpdate extends CommonBase { long clone_ptr() { long ret = bindings.ChannelUpdate_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +83,7 @@ public class ChannelUpdate extends CommonBase { */ public ChannelUpdate clone() { long ret = bindings.ChannelUpdate_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -84,6 +95,7 @@ public class ChannelUpdate extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ChannelUpdate_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +104,7 @@ public class ChannelUpdate extends CommonBase { */ public static Result_ChannelUpdateDecodeErrorZ read(byte[] ser) { long ret = bindings.ChannelUpdate_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelUpdateDecodeErrorZ ret_hu_conv = Result_ChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ClosingSigned.java b/src/main/java/org/ldk/structs/ClosingSigned.java index a67baf21..8f4823fc 100644 --- a/src/main/java/org/ldk/structs/ClosingSigned.java +++ b/src/main/java/org/ldk/structs/ClosingSigned.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ClosingSigned extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.ClosingSigned_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class ClosingSigned extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.ClosingSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class ClosingSigned extends CommonBase { */ public long get_fee_satoshis() { long ret = bindings.ClosingSigned_get_fee_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class ClosingSigned extends CommonBase { */ public void set_fee_satoshis(long val) { bindings.ClosingSigned_set_fee_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class ClosingSigned extends CommonBase { */ public byte[] get_signature() { byte[] ret = bindings.ClosingSigned_get_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class ClosingSigned extends CommonBase { */ public void set_signature(byte[] val) { bindings.ClosingSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -73,6 +83,7 @@ public class ClosingSigned extends CommonBase { @Nullable public ClosingSignedFeeRange get_fee_range() { long ret = bindings.ClosingSigned_get_fee_range(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingSignedFeeRange(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -87,6 +98,8 @@ public class ClosingSigned extends CommonBase { */ public void set_fee_range(@Nullable ClosingSignedFeeRange val) { bindings.ClosingSigned_set_fee_range(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -94,6 +107,10 @@ public class ClosingSigned extends CommonBase { */ public static ClosingSigned of(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg, ClosingSignedFeeRange fee_range_arg) { long ret = bindings.ClosingSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), fee_satoshis_arg, InternalUtils.check_arr_len(signature_arg, 64), fee_range_arg == null ? 0 : fee_range_arg.ptr & ~1); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(fee_satoshis_arg); + Reference.reachabilityFence(signature_arg); + Reference.reachabilityFence(fee_range_arg); if (ret >= 0 && ret <= 4096) { return null; } ClosingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingSigned(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -102,6 +119,7 @@ public class ClosingSigned extends CommonBase { long clone_ptr() { long ret = bindings.ClosingSigned_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -110,6 +128,7 @@ public class ClosingSigned extends CommonBase { */ public ClosingSigned clone() { long ret = bindings.ClosingSigned_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ClosingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingSigned(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -121,6 +140,7 @@ public class ClosingSigned extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ClosingSigned_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -129,6 +149,7 @@ public class ClosingSigned extends CommonBase { */ public static Result_ClosingSignedDecodeErrorZ read(byte[] ser) { long ret = bindings.ClosingSigned_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java b/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java index 7d17307e..b8f77a9b 100644 --- a/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java +++ b/src/main/java/org/ldk/structs/ClosingSignedFeeRange.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class ClosingSignedFeeRange extends CommonBase { */ public long get_min_fee_satoshis() { long ret = bindings.ClosingSignedFeeRange_get_min_fee_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -36,6 +38,8 @@ public class ClosingSignedFeeRange extends CommonBase { */ public void set_min_fee_satoshis(long val) { bindings.ClosingSignedFeeRange_set_min_fee_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -44,6 +48,7 @@ public class ClosingSignedFeeRange extends CommonBase { */ public long get_max_fee_satoshis() { long ret = bindings.ClosingSignedFeeRange_get_max_fee_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +58,8 @@ public class ClosingSignedFeeRange extends CommonBase { */ public void set_max_fee_satoshis(long val) { bindings.ClosingSignedFeeRange_set_max_fee_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -60,6 +67,8 @@ public class ClosingSignedFeeRange extends CommonBase { */ public static ClosingSignedFeeRange of(long min_fee_satoshis_arg, long max_fee_satoshis_arg) { long ret = bindings.ClosingSignedFeeRange_new(min_fee_satoshis_arg, max_fee_satoshis_arg); + Reference.reachabilityFence(min_fee_satoshis_arg); + Reference.reachabilityFence(max_fee_satoshis_arg); if (ret >= 0 && ret <= 4096) { return null; } ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingSignedFeeRange(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -68,6 +77,7 @@ public class ClosingSignedFeeRange extends CommonBase { long clone_ptr() { long ret = bindings.ClosingSignedFeeRange_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -76,6 +86,7 @@ public class ClosingSignedFeeRange extends CommonBase { */ public ClosingSignedFeeRange clone() { long ret = bindings.ClosingSignedFeeRange_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingSignedFeeRange(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -87,6 +98,7 @@ public class ClosingSignedFeeRange extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ClosingSignedFeeRange_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -95,6 +107,7 @@ public class ClosingSignedFeeRange extends CommonBase { */ public static Result_ClosingSignedFeeRangeDecodeErrorZ read(byte[] ser) { long ret = bindings.ClosingSignedFeeRange_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ClosingTransaction.java b/src/main/java/org/ldk/structs/ClosingTransaction.java index 35de3c83..8aba7dfd 100644 --- a/src/main/java/org/ldk/structs/ClosingTransaction.java +++ b/src/main/java/org/ldk/structs/ClosingTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class ClosingTransaction extends CommonBase { long clone_ptr() { long ret = bindings.ClosingTransaction_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -33,6 +35,7 @@ public class ClosingTransaction extends CommonBase { */ public ClosingTransaction clone() { long ret = bindings.ClosingTransaction_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ClosingTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -44,14 +47,23 @@ public class ClosingTransaction extends CommonBase { */ public long hash() { long ret = bindings.ClosingTransaction_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Construct an object of the class */ public static ClosingTransaction of(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, OutPoint funding_outpoint) { long ret = bindings.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1); + Reference.reachabilityFence(to_holder_value_sat); + Reference.reachabilityFence(to_counterparty_value_sat); + Reference.reachabilityFence(to_holder_script); + Reference.reachabilityFence(to_counterparty_script); + Reference.reachabilityFence(funding_outpoint); if (ret >= 0 && ret <= 4096) { return null; } ClosingTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ClosingTransaction(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -68,6 +80,7 @@ public class ClosingTransaction extends CommonBase { */ public TrustedClosingTransaction trust() { long ret = bindings.ClosingTransaction_trust(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TrustedClosingTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TrustedClosingTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -84,6 +97,8 @@ public class ClosingTransaction extends CommonBase { */ public Result_TrustedClosingTransactionNoneZ verify(OutPoint funding_outpoint) { long ret = bindings.ClosingTransaction_verify(this.ptr, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_outpoint); if (ret >= 0 && ret <= 4096) { return null; } Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -94,6 +109,7 @@ public class ClosingTransaction extends CommonBase { */ public long to_holder_value_sat() { long ret = bindings.ClosingTransaction_to_holder_value_sat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -102,6 +118,7 @@ public class ClosingTransaction extends CommonBase { */ public long to_counterparty_value_sat() { long ret = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -110,6 +127,7 @@ public class ClosingTransaction extends CommonBase { */ public byte[] to_holder_script() { byte[] ret = bindings.ClosingTransaction_to_holder_script(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -118,6 +136,7 @@ public class ClosingTransaction extends CommonBase { */ public byte[] to_counterparty_script() { byte[] ret = bindings.ClosingTransaction_to_counterparty_script(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/ClosureReason.java b/src/main/java/org/ldk/structs/ClosureReason.java index 88ac1573..ad198c32 100644 --- a/src/main/java/org/ldk/structs/ClosureReason.java +++ b/src/main/java/org/ldk/structs/ClosureReason.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -32,6 +33,9 @@ public class ClosureReason extends CommonBase { if (raw_val.getClass() == bindings.LDKClosureReason.CommitmentTxConfirmed.class) { return new CommitmentTxConfirmed(ptr, (bindings.LDKClosureReason.CommitmentTxConfirmed)raw_val); } + if (raw_val.getClass() == bindings.LDKClosureReason.FundingTimedOut.class) { + return new FundingTimedOut(ptr, (bindings.LDKClosureReason.FundingTimedOut)raw_val); + } if (raw_val.getClass() == bindings.LDKClosureReason.ProcessingError.class) { return new ProcessingError(ptr, (bindings.LDKClosureReason.ProcessingError)raw_val); } @@ -93,6 +97,14 @@ public class ClosureReason extends CommonBase { super(null, ptr); } } + /** + * The funding transaction failed to confirm in a timely manner on an inbound channel. + */ + public final static class FundingTimedOut extends ClosureReason { + private FundingTimedOut(long ptr, bindings.LDKClosureReason.FundingTimedOut obj) { + super(null, ptr); + } + } /** * Closure generated from processing an event, likely a HTLC forward/relay/reception. */ @@ -129,6 +141,7 @@ public class ClosureReason extends CommonBase { } long clone_ptr() { long ret = bindings.ClosureReason_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -137,6 +150,7 @@ public class ClosureReason extends CommonBase { */ public ClosureReason clone() { long ret = bindings.ClosureReason_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -148,6 +162,7 @@ public class ClosureReason extends CommonBase { */ public static ClosureReason counterparty_force_closed(java.lang.String peer_msg) { long ret = bindings.ClosureReason_counterparty_force_closed(peer_msg); + Reference.reachabilityFence(peer_msg); if (ret >= 0 && ret <= 4096) { return null; } ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -187,11 +202,23 @@ public class ClosureReason extends CommonBase { return ret_hu_conv; } + /** + * Utility method to constructs a new FundingTimedOut-variant ClosureReason + */ + public static ClosureReason funding_timed_out() { + long ret = bindings.ClosureReason_funding_timed_out(); + if (ret >= 0 && ret <= 4096) { return null; } + ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + /** * Utility method to constructs a new ProcessingError-variant ClosureReason */ public static ClosureReason processing_error(java.lang.String err) { long ret = bindings.ClosureReason_processing_error(err); + Reference.reachabilityFence(err); if (ret >= 0 && ret <= 4096) { return null; } ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -225,6 +252,7 @@ public class ClosureReason extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ClosureReason_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/CommitmentSigned.java b/src/main/java/org/ldk/structs/CommitmentSigned.java index adce70a4..d9645922 100644 --- a/src/main/java/org/ldk/structs/CommitmentSigned.java +++ b/src/main/java/org/ldk/structs/CommitmentSigned.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class CommitmentSigned extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.CommitmentSigned_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class CommitmentSigned extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.CommitmentSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class CommitmentSigned extends CommonBase { */ public byte[] get_signature() { byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class CommitmentSigned extends CommonBase { */ public void set_signature(byte[] val) { bindings.CommitmentSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,8 @@ public class CommitmentSigned extends CommonBase { */ public void set_htlc_signatures(byte[][] val) { bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val != null ? Arrays.stream(val).map(val_conv_8 -> InternalUtils.check_arr_len(val_conv_8, 64)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -61,6 +70,9 @@ public class CommitmentSigned extends CommonBase { */ public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) { long ret = bindings.CommitmentSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(signature_arg, 64), htlc_signatures_arg != null ? Arrays.stream(htlc_signatures_arg).map(htlc_signatures_arg_conv_8 -> InternalUtils.check_arr_len(htlc_signatures_arg_conv_8, 64)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(signature_arg); + Reference.reachabilityFence(htlc_signatures_arg); if (ret >= 0 && ret <= 4096) { return null; } CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentSigned(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -69,6 +81,7 @@ public class CommitmentSigned extends CommonBase { long clone_ptr() { long ret = bindings.CommitmentSigned_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +90,7 @@ public class CommitmentSigned extends CommonBase { */ public CommitmentSigned clone() { long ret = bindings.CommitmentSigned_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentSigned(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -88,6 +102,7 @@ public class CommitmentSigned extends CommonBase { */ public byte[] write() { byte[] ret = bindings.CommitmentSigned_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -96,6 +111,7 @@ public class CommitmentSigned extends CommonBase { */ public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) { long ret = bindings.CommitmentSigned_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/CommitmentTransaction.java b/src/main/java/org/ldk/structs/CommitmentTransaction.java index b4dda525..920975d3 100644 --- a/src/main/java/org/ldk/structs/CommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/CommitmentTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,6 +27,7 @@ public class CommitmentTransaction extends CommonBase { long clone_ptr() { long ret = bindings.CommitmentTransaction_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -34,6 +36,7 @@ public class CommitmentTransaction extends CommonBase { */ public CommitmentTransaction clone() { long ret = bindings.CommitmentTransaction_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -45,6 +48,7 @@ public class CommitmentTransaction extends CommonBase { */ public byte[] write() { byte[] ret = bindings.CommitmentTransaction_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +57,7 @@ public class CommitmentTransaction extends CommonBase { */ public static Result_CommitmentTransactionDecodeErrorZ read(byte[] ser) { long ret = bindings.CommitmentTransaction_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,6 +68,7 @@ public class CommitmentTransaction extends CommonBase { */ public long commitment_number() { long ret = bindings.CommitmentTransaction_commitment_number(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -71,6 +77,7 @@ public class CommitmentTransaction extends CommonBase { */ public long to_broadcaster_value_sat() { long ret = bindings.CommitmentTransaction_to_broadcaster_value_sat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -79,6 +86,7 @@ public class CommitmentTransaction extends CommonBase { */ public long to_countersignatory_value_sat() { long ret = bindings.CommitmentTransaction_to_countersignatory_value_sat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -87,6 +95,7 @@ public class CommitmentTransaction extends CommonBase { */ public int feerate_per_kw() { int ret = bindings.CommitmentTransaction_feerate_per_kw(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -100,6 +109,7 @@ public class CommitmentTransaction extends CommonBase { */ public TrustedCommitmentTransaction trust() { long ret = bindings.CommitmentTransaction_trust(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TrustedCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TrustedCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -116,6 +126,10 @@ public class CommitmentTransaction extends CommonBase { */ public Result_TrustedCommitmentTransactionNoneZ verify(DirectedChannelTransactionParameters channel_parameters, ChannelPublicKeys broadcaster_keys, ChannelPublicKeys countersignatory_keys) { long ret = bindings.CommitmentTransaction_verify(this.ptr, channel_parameters == null ? 0 : channel_parameters.ptr & ~1, broadcaster_keys == null ? 0 : broadcaster_keys.ptr & ~1, countersignatory_keys == null ? 0 : countersignatory_keys.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_parameters); + Reference.reachabilityFence(broadcaster_keys); + Reference.reachabilityFence(countersignatory_keys); if (ret >= 0 && ret <= 4096) { return null; } Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret); this.ptrs_to.add(channel_parameters); diff --git a/src/main/java/org/ldk/structs/CommitmentUpdate.java b/src/main/java/org/ldk/structs/CommitmentUpdate.java index 8b8e32dd..6a322834 100644 --- a/src/main/java/org/ldk/structs/CommitmentUpdate.java +++ b/src/main/java/org/ldk/structs/CommitmentUpdate.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class CommitmentUpdate extends CommonBase { */ public UpdateAddHTLC[] get_update_add_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_add_htlcs(this.ptr); + Reference.reachabilityFence(this); UpdateAddHTLC[] ret_conv_15_arr = new UpdateAddHTLC[ret.length]; for (int p = 0; p < ret.length; p++) { long ret_conv_15 = ret[p]; @@ -40,6 +42,8 @@ public class CommitmentUpdate extends CommonBase { */ public void set_update_add_htlcs(UpdateAddHTLC[] val) { bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -47,6 +51,7 @@ public class CommitmentUpdate extends CommonBase { */ public UpdateFulfillHTLC[] get_update_fulfill_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_fulfill_htlcs(this.ptr); + Reference.reachabilityFence(this); UpdateFulfillHTLC[] ret_conv_19_arr = new UpdateFulfillHTLC[ret.length]; for (int t = 0; t < ret.length; t++) { long ret_conv_19 = ret[t]; @@ -62,6 +67,8 @@ public class CommitmentUpdate extends CommonBase { */ public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) { bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +76,7 @@ public class CommitmentUpdate extends CommonBase { */ public UpdateFailHTLC[] get_update_fail_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_fail_htlcs(this.ptr); + Reference.reachabilityFence(this); UpdateFailHTLC[] ret_conv_16_arr = new UpdateFailHTLC[ret.length]; for (int q = 0; q < ret.length; q++) { long ret_conv_16 = ret[q]; @@ -84,6 +92,8 @@ public class CommitmentUpdate extends CommonBase { */ public void set_update_fail_htlcs(UpdateFailHTLC[] val) { bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -91,6 +101,7 @@ public class CommitmentUpdate extends CommonBase { */ public UpdateFailMalformedHTLC[] get_update_fail_malformed_htlcs() { long[] ret = bindings.CommitmentUpdate_get_update_fail_malformed_htlcs(this.ptr); + Reference.reachabilityFence(this); UpdateFailMalformedHTLC[] ret_conv_25_arr = new UpdateFailMalformedHTLC[ret.length]; for (int z = 0; z < ret.length; z++) { long ret_conv_25 = ret[z]; @@ -106,6 +117,8 @@ public class CommitmentUpdate extends CommonBase { */ public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) { bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -116,6 +129,7 @@ public class CommitmentUpdate extends CommonBase { @Nullable public UpdateFee get_update_fee() { long ret = bindings.CommitmentUpdate_get_update_fee(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFee(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -129,6 +143,8 @@ public class CommitmentUpdate extends CommonBase { */ public void set_update_fee(@Nullable UpdateFee val) { bindings.CommitmentUpdate_set_update_fee(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -136,6 +152,7 @@ public class CommitmentUpdate extends CommonBase { */ public CommitmentSigned get_commitment_signed() { long ret = bindings.CommitmentUpdate_get_commitment_signed(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentSigned(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -147,6 +164,8 @@ public class CommitmentUpdate extends CommonBase { */ public void set_commitment_signed(CommitmentSigned val) { bindings.CommitmentUpdate_set_commitment_signed(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -154,6 +173,12 @@ public class CommitmentUpdate extends CommonBase { */ public static CommitmentUpdate of(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, UpdateFee update_fee_arg, CommitmentSigned commitment_signed_arg) { long ret = bindings.CommitmentUpdate_new(update_add_htlcs_arg != null ? Arrays.stream(update_add_htlcs_arg).mapToLong(update_add_htlcs_arg_conv_15 -> update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr & ~1).toArray() : null, update_fulfill_htlcs_arg != null ? Arrays.stream(update_fulfill_htlcs_arg).mapToLong(update_fulfill_htlcs_arg_conv_19 -> update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr & ~1).toArray() : null, update_fail_htlcs_arg != null ? Arrays.stream(update_fail_htlcs_arg).mapToLong(update_fail_htlcs_arg_conv_16 -> update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr & ~1).toArray() : null, update_fail_malformed_htlcs_arg != null ? Arrays.stream(update_fail_malformed_htlcs_arg).mapToLong(update_fail_malformed_htlcs_arg_conv_25 -> update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr & ~1).toArray() : null, update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1); + Reference.reachabilityFence(update_add_htlcs_arg); + Reference.reachabilityFence(update_fulfill_htlcs_arg); + Reference.reachabilityFence(update_fail_htlcs_arg); + Reference.reachabilityFence(update_fail_malformed_htlcs_arg); + Reference.reachabilityFence(update_fee_arg); + Reference.reachabilityFence(commitment_signed_arg); if (ret >= 0 && ret <= 4096) { return null; } CommitmentUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentUpdate(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -162,6 +187,7 @@ public class CommitmentUpdate extends CommonBase { long clone_ptr() { long ret = bindings.CommitmentUpdate_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -170,6 +196,7 @@ public class CommitmentUpdate extends CommonBase { */ public CommitmentUpdate clone() { long ret = bindings.CommitmentUpdate_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CommitmentUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CommitmentUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Confirm.java b/src/main/java/org/ldk/structs/Confirm.java index bfa6bbe6..d98c868f 100644 --- a/src/main/java/org/ldk/structs/Confirm.java +++ b/src/main/java/org/ldk/structs/Confirm.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -151,6 +152,10 @@ public class Confirm extends CommonBase { */ public void transactions_confirmed(byte[] header, TwoTuple_usizeTransactionZ[] txdata, int height) { bindings.Confirm_transactions_confirmed(this.ptr, InternalUtils.check_arr_len(header, 80), txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_28 -> txdata_conv_28 != null ? txdata_conv_28.ptr : 0).toArray() : null, height); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(txdata); + Reference.reachabilityFence(height); } /** @@ -165,6 +170,8 @@ public class Confirm extends CommonBase { */ public void transaction_unconfirmed(byte[] txid) { bindings.Confirm_transaction_unconfirmed(this.ptr, InternalUtils.check_arr_len(txid, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(txid); } /** @@ -175,6 +182,9 @@ public class Confirm extends CommonBase { */ public void best_block_updated(byte[] header, int height) { bindings.Confirm_best_block_updated(this.ptr, InternalUtils.check_arr_len(header, 80), height); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(height); } /** @@ -194,6 +204,7 @@ public class Confirm extends CommonBase { */ public byte[][] get_relevant_txids() { byte[][] ret = bindings.Confirm_get_relevant_txids(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/CounterpartyChannelTransactionParameters.java b/src/main/java/org/ldk/structs/CounterpartyChannelTransactionParameters.java index e4317035..94e7ee66 100644 --- a/src/main/java/org/ldk/structs/CounterpartyChannelTransactionParameters.java +++ b/src/main/java/org/ldk/structs/CounterpartyChannelTransactionParameters.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public ChannelPublicKeys get_pubkeys() { long ret = bindings.CounterpartyChannelTransactionParameters_get_pubkeys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,8 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public void set_pubkeys(ChannelPublicKeys val) { bindings.CounterpartyChannelTransactionParameters_set_pubkeys(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public short get_selected_contest_delay() { short ret = bindings.CounterpartyChannelTransactionParameters_get_selected_contest_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public void set_selected_contest_delay(short val) { bindings.CounterpartyChannelTransactionParameters_set_selected_contest_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,8 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public static CounterpartyChannelTransactionParameters of(ChannelPublicKeys pubkeys_arg, short selected_contest_delay_arg) { long ret = bindings.CounterpartyChannelTransactionParameters_new(pubkeys_arg == null ? 0 : pubkeys_arg.ptr & ~1, selected_contest_delay_arg); + Reference.reachabilityFence(pubkeys_arg); + Reference.reachabilityFence(selected_contest_delay_arg); if (ret >= 0 && ret <= 4096) { return null; } CounterpartyChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -65,6 +74,7 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { long clone_ptr() { long ret = bindings.CounterpartyChannelTransactionParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +83,7 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public CounterpartyChannelTransactionParameters clone() { long ret = bindings.CounterpartyChannelTransactionParameters_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CounterpartyChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -84,6 +95,7 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public byte[] write() { byte[] ret = bindings.CounterpartyChannelTransactionParameters_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +104,7 @@ public class CounterpartyChannelTransactionParameters extends CommonBase { */ public static Result_CounterpartyChannelTransactionParametersDecodeErrorZ read(byte[] ser) { long ret = bindings.CounterpartyChannelTransactionParameters_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_CounterpartyChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java b/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java index cfd35f4f..e6a95f76 100644 --- a/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java +++ b/src/main/java/org/ldk/structs/CounterpartyForwardingInfo.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public int get_fee_base_msat() { int ret = bindings.CounterpartyForwardingInfo_get_fee_base_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public void set_fee_base_msat(int val) { bindings.CounterpartyForwardingInfo_set_fee_base_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public int get_fee_proportional_millionths() { int ret = bindings.CounterpartyForwardingInfo_get_fee_proportional_millionths(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public void set_fee_proportional_millionths(int val) { bindings.CounterpartyForwardingInfo_set_fee_proportional_millionths(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -56,6 +63,7 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public short get_cltv_expiry_delta() { short ret = bindings.CounterpartyForwardingInfo_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -66,6 +74,8 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public void set_cltv_expiry_delta(short val) { bindings.CounterpartyForwardingInfo_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -73,6 +83,9 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public static CounterpartyForwardingInfo of(int fee_base_msat_arg, int fee_proportional_millionths_arg, short cltv_expiry_delta_arg) { long ret = bindings.CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg); + Reference.reachabilityFence(fee_base_msat_arg); + Reference.reachabilityFence(fee_proportional_millionths_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); if (ret >= 0 && ret <= 4096) { return null; } CounterpartyForwardingInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyForwardingInfo(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -81,6 +94,7 @@ public class CounterpartyForwardingInfo extends CommonBase { long clone_ptr() { long ret = bindings.CounterpartyForwardingInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -89,6 +103,7 @@ public class CounterpartyForwardingInfo extends CommonBase { */ public CounterpartyForwardingInfo clone() { long ret = bindings.CounterpartyForwardingInfo_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CounterpartyForwardingInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new CounterpartyForwardingInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/CustomMessageHandler.java b/src/main/java/org/ldk/structs/CustomMessageHandler.java index 06354d6a..d5021049 100644 --- a/src/main/java/org/ldk/structs/CustomMessageHandler.java +++ b/src/main/java/org/ldk/structs/CustomMessageHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -73,6 +74,9 @@ public class CustomMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_custom_message(Type msg, byte[] sender_node_id) { long ret = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg == null ? 0 : msg.ptr, InternalUtils.check_arr_len(sender_node_id, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(sender_node_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -87,6 +91,7 @@ public class CustomMessageHandler extends CommonBase { */ public TwoTuple_PublicKeyTypeZ[] get_and_clear_pending_msg() { long[] ret = bindings.CustomMessageHandler_get_and_clear_pending_msg(this.ptr); + Reference.reachabilityFence(this); TwoTuple_PublicKeyTypeZ[] ret_conv_25_arr = new TwoTuple_PublicKeyTypeZ[ret.length]; for (int z = 0; z < ret.length; z++) { long ret_conv_25 = ret[z]; diff --git a/src/main/java/org/ldk/structs/CustomMessageReader.java b/src/main/java/org/ldk/structs/CustomMessageReader.java index 816d3783..92378e08 100644 --- a/src/main/java/org/ldk/structs/CustomMessageReader.java +++ b/src/main/java/org/ldk/structs/CustomMessageReader.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -53,6 +54,9 @@ public class CustomMessageReader extends CommonBase { */ public Result_COption_TypeZDecodeErrorZ read(short message_type, byte[] buffer) { long ret = bindings.CustomMessageReader_read(this.ptr, message_type, buffer); + Reference.reachabilityFence(this); + Reference.reachabilityFence(message_type); + Reference.reachabilityFence(buffer); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/DataLossProtect.java b/src/main/java/org/ldk/structs/DataLossProtect.java index 2b36e90a..d316e5f3 100644 --- a/src/main/java/org/ldk/structs/DataLossProtect.java +++ b/src/main/java/org/ldk/structs/DataLossProtect.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -28,6 +29,7 @@ public class DataLossProtect extends CommonBase { */ public byte[] get_your_last_per_commitment_secret() { byte[] ret = bindings.DataLossProtect_get_your_last_per_commitment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -37,6 +39,8 @@ public class DataLossProtect extends CommonBase { */ public void set_your_last_per_commitment_secret(byte[] val) { bindings.DataLossProtect_set_your_last_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -44,6 +48,7 @@ public class DataLossProtect extends CommonBase { */ public byte[] get_my_current_per_commitment_point() { byte[] ret = bindings.DataLossProtect_get_my_current_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -52,6 +57,8 @@ public class DataLossProtect extends CommonBase { */ public void set_my_current_per_commitment_point(byte[] val) { bindings.DataLossProtect_set_my_current_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -59,6 +66,8 @@ public class DataLossProtect extends CommonBase { */ public static DataLossProtect of(byte[] your_last_per_commitment_secret_arg, byte[] my_current_per_commitment_point_arg) { long ret = bindings.DataLossProtect_new(InternalUtils.check_arr_len(your_last_per_commitment_secret_arg, 32), InternalUtils.check_arr_len(my_current_per_commitment_point_arg, 33)); + Reference.reachabilityFence(your_last_per_commitment_secret_arg); + Reference.reachabilityFence(my_current_per_commitment_point_arg); if (ret >= 0 && ret <= 4096) { return null; } DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DataLossProtect(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -67,6 +76,7 @@ public class DataLossProtect extends CommonBase { long clone_ptr() { long ret = bindings.DataLossProtect_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +85,7 @@ public class DataLossProtect extends CommonBase { */ public DataLossProtect clone() { long ret = bindings.DataLossProtect_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DataLossProtect(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/DecodeError.java b/src/main/java/org/ldk/structs/DecodeError.java index 64206c55..a6f4c479 100644 --- a/src/main/java/org/ldk/structs/DecodeError.java +++ b/src/main/java/org/ldk/structs/DecodeError.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class DecodeError extends CommonBase { long clone_ptr() { long ret = bindings.DecodeError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class DecodeError extends CommonBase { */ public DecodeError clone() { long ret = bindings.DecodeError_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DecodeError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DecodeError(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/DefaultRouter.java b/src/main/java/org/ldk/structs/DefaultRouter.java index ae3fb4c7..964a0cf5 100644 --- a/src/main/java/org/ldk/structs/DefaultRouter.java +++ b/src/main/java/org/ldk/structs/DefaultRouter.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,8 @@ public class DefaultRouter extends CommonBase { */ public static DefaultRouter of(NetworkGraph network_graph, Logger logger) { long ret = bindings.DefaultRouter_new(network_graph == null ? 0 : network_graph.ptr & ~1, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(network_graph); + Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } DefaultRouter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DefaultRouter(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -38,6 +41,7 @@ public class DefaultRouter extends CommonBase { */ public Router as_Router() { long ret = bindings.DefaultRouter_as_Router(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Router ret_hu_conv = new Router(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java b/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java index a8ddbf3f..8ab2a73b 100644 --- a/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/DelayedPaymentOutputDescriptor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public OutPoint get_outpoint() { long ret = bindings.DelayedPaymentOutputDescriptor_get_outpoint(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -36,6 +38,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_outpoint(OutPoint val) { bindings.DelayedPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public byte[] get_per_commitment_point() { byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -51,6 +56,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_per_commitment_point(byte[] val) { bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -59,6 +66,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public short get_to_self_delay() { short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -68,6 +76,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_to_self_delay(short val) { bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -75,6 +85,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_output(TxOut val) { bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -83,6 +95,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public byte[] get_revocation_pubkey() { byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +105,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_revocation_pubkey(byte[] val) { bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -101,6 +116,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public byte[] get_channel_keys_id() { byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -111,6 +127,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_channel_keys_id(byte[] val) { bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -118,6 +136,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public long get_channel_value_satoshis() { long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -126,6 +145,8 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public void set_channel_value_satoshis(long val) { bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -133,6 +154,13 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public static DelayedPaymentOutputDescriptor of(OutPoint outpoint_arg, byte[] per_commitment_point_arg, short to_self_delay_arg, TxOut output_arg, byte[] revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) { long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, InternalUtils.check_arr_len(per_commitment_point_arg, 33), to_self_delay_arg, output_arg.ptr, InternalUtils.check_arr_len(revocation_pubkey_arg, 33), InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg); + Reference.reachabilityFence(outpoint_arg); + Reference.reachabilityFence(per_commitment_point_arg); + Reference.reachabilityFence(to_self_delay_arg); + Reference.reachabilityFence(output_arg); + Reference.reachabilityFence(revocation_pubkey_arg); + Reference.reachabilityFence(channel_keys_id_arg); + Reference.reachabilityFence(channel_value_satoshis_arg); if (ret >= 0 && ret <= 4096) { return null; } DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -141,6 +169,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { long clone_ptr() { long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -149,6 +178,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public DelayedPaymentOutputDescriptor clone() { long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -160,6 +190,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public byte[] write() { byte[] ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -168,6 +199,7 @@ public class DelayedPaymentOutputDescriptor extends CommonBase { */ public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) { long ret = bindings.DelayedPaymentOutputDescriptor_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Description.java b/src/main/java/org/ldk/structs/Description.java index 8e8f68ff..e6fa239f 100644 --- a/src/main/java/org/ldk/structs/Description.java +++ b/src/main/java/org/ldk/structs/Description.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class Description extends CommonBase { long clone_ptr() { long ret = bindings.Description_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class Description extends CommonBase { */ public Description clone() { long ret = bindings.Description_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Description(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -43,9 +46,13 @@ public class Description extends CommonBase { */ public long hash() { long ret = bindings.Description_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two Descriptions contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -53,10 +60,16 @@ public class Description extends CommonBase { */ public boolean eq(Description b) { boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Description)) return false; + return this.eq((Description)o); + } /** * Creates a new `Description` if `description` is at most 1023 __bytes__ long, * returns `CreationError::DescriptionTooLong` otherwise @@ -65,6 +78,7 @@ public class Description extends CommonBase { */ public static Result_DescriptionCreationErrorZ of(java.lang.String description) { long ret = bindings.Description_new(description); + Reference.reachabilityFence(description); if (ret >= 0 && ret <= 4096) { return null; } Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -75,6 +89,7 @@ public class Description extends CommonBase { */ public String into_inner() { String ret = bindings.Description_into_inner(this.ptr); + Reference.reachabilityFence(this); ; return ret; } diff --git a/src/main/java/org/ldk/structs/DirectedChannelTransactionParameters.java b/src/main/java/org/ldk/structs/DirectedChannelTransactionParameters.java index 36da8574..21b66476 100644 --- a/src/main/java/org/ldk/structs/DirectedChannelTransactionParameters.java +++ b/src/main/java/org/ldk/structs/DirectedChannelTransactionParameters.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -28,6 +29,7 @@ public class DirectedChannelTransactionParameters extends CommonBase { */ public ChannelPublicKeys broadcaster_pubkeys() { long ret = bindings.DirectedChannelTransactionParameters_broadcaster_pubkeys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -39,6 +41,7 @@ public class DirectedChannelTransactionParameters extends CommonBase { */ public ChannelPublicKeys countersignatory_pubkeys() { long ret = bindings.DirectedChannelTransactionParameters_countersignatory_pubkeys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -51,6 +54,7 @@ public class DirectedChannelTransactionParameters extends CommonBase { */ public short contest_delay() { short ret = bindings.DirectedChannelTransactionParameters_contest_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +66,7 @@ public class DirectedChannelTransactionParameters extends CommonBase { */ public boolean is_outbound() { boolean ret = bindings.DirectedChannelTransactionParameters_is_outbound(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,10 +75,20 @@ public class DirectedChannelTransactionParameters extends CommonBase { */ public OutPoint funding_outpoint() { long ret = bindings.DirectedChannelTransactionParameters_funding_outpoint(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Whether to use anchors for this channel + */ + public boolean opt_anchors() { + boolean ret = bindings.DirectedChannelTransactionParameters_opt_anchors(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java index 55da7871..03093d27 100644 --- a/src/main/java/org/ldk/structs/DirectionalChannelInfo.java +++ b/src/main/java/org/ldk/structs/DirectionalChannelInfo.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,6 +27,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public int get_last_update() { int ret = bindings.DirectionalChannelInfo_get_last_update(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -35,6 +37,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_last_update(int val) { bindings.DirectionalChannelInfo_set_last_update(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public boolean get_enabled() { boolean ret = bindings.DirectionalChannelInfo_get_enabled(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_enabled(boolean val) { bindings.DirectionalChannelInfo_set_enabled(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public short get_cltv_expiry_delta() { short ret = bindings.DirectionalChannelInfo_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -65,6 +73,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_cltv_expiry_delta(short val) { bindings.DirectionalChannelInfo_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +82,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public long get_htlc_minimum_msat() { long ret = bindings.DirectionalChannelInfo_get_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +91,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_htlc_minimum_msat(long val) { bindings.DirectionalChannelInfo_set_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -87,6 +100,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public Option_u64Z get_htlc_maximum_msat() { long ret = bindings.DirectionalChannelInfo_get_htlc_maximum_msat(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -98,6 +112,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_htlc_maximum_msat(Option_u64Z val) { bindings.DirectionalChannelInfo_set_htlc_maximum_msat(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -105,6 +121,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public RoutingFees get_fees() { long ret = bindings.DirectionalChannelInfo_get_fees(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -116,6 +133,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_fees(RoutingFees val) { bindings.DirectionalChannelInfo_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -129,6 +148,7 @@ public class DirectionalChannelInfo extends CommonBase { @Nullable public ChannelUpdate get_last_update_message() { long ret = bindings.DirectionalChannelInfo_get_last_update_message(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -145,6 +165,8 @@ public class DirectionalChannelInfo extends CommonBase { */ public void set_last_update_message(@Nullable ChannelUpdate val) { bindings.DirectionalChannelInfo_set_last_update_message(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -152,6 +174,13 @@ public class DirectionalChannelInfo extends CommonBase { */ public static DirectionalChannelInfo of(int last_update_arg, boolean enabled_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg, RoutingFees fees_arg, ChannelUpdate last_update_message_arg) { long ret = bindings.DirectionalChannelInfo_new(last_update_arg, enabled_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg.ptr, fees_arg == null ? 0 : fees_arg.ptr & ~1, last_update_message_arg == null ? 0 : last_update_message_arg.ptr & ~1); + Reference.reachabilityFence(last_update_arg); + Reference.reachabilityFence(enabled_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); + Reference.reachabilityFence(htlc_minimum_msat_arg); + Reference.reachabilityFence(htlc_maximum_msat_arg); + Reference.reachabilityFence(fees_arg); + Reference.reachabilityFence(last_update_message_arg); if (ret >= 0 && ret <= 4096) { return null; } DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -160,6 +189,7 @@ public class DirectionalChannelInfo extends CommonBase { long clone_ptr() { long ret = bindings.DirectionalChannelInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -168,6 +198,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public DirectionalChannelInfo clone() { long ret = bindings.DirectionalChannelInfo_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } DirectionalChannelInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DirectionalChannelInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -179,6 +210,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public byte[] write() { byte[] ret = bindings.DirectionalChannelInfo_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -187,6 +219,7 @@ public class DirectionalChannelInfo extends CommonBase { */ public static Result_DirectionalChannelInfoDecodeErrorZ read(byte[] ser) { long ret = bindings.DirectionalChannelInfo_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ErrorAction.java b/src/main/java/org/ldk/structs/ErrorAction.java index ec2ae18f..b7e592dd 100644 --- a/src/main/java/org/ldk/structs/ErrorAction.java +++ b/src/main/java/org/ldk/structs/ErrorAction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -29,6 +30,9 @@ public class ErrorAction extends CommonBase { if (raw_val.getClass() == bindings.LDKErrorAction.IgnoreAndLog.class) { return new IgnoreAndLog(ptr, (bindings.LDKErrorAction.IgnoreAndLog)raw_val); } + if (raw_val.getClass() == bindings.LDKErrorAction.IgnoreDuplicateGossip.class) { + return new IgnoreDuplicateGossip(ptr, (bindings.LDKErrorAction.IgnoreDuplicateGossip)raw_val); + } if (raw_val.getClass() == bindings.LDKErrorAction.SendErrorMessage.class) { return new SendErrorMessage(ptr, (bindings.LDKErrorAction.SendErrorMessage)raw_val); } @@ -72,6 +76,16 @@ public class ErrorAction extends CommonBase { this.ignore_and_log = obj.ignore_and_log; } } + /** + * The peer provided us with a gossip message which we'd already seen. In most cases this + * should be ignored, but it may result in the message being forwarded if it is a duplicate of + * our own channel announcements. + */ + public final static class IgnoreDuplicateGossip extends ErrorAction { + private IgnoreDuplicateGossip(long ptr, bindings.LDKErrorAction.IgnoreDuplicateGossip obj) { + super(null, ptr); + } + } /** * The peer did something incorrect. Tell them. */ @@ -90,6 +104,7 @@ public class ErrorAction extends CommonBase { } long clone_ptr() { long ret = bindings.ErrorAction_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -98,6 +113,7 @@ public class ErrorAction extends CommonBase { */ public ErrorAction clone() { long ret = bindings.ErrorAction_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -109,6 +125,7 @@ public class ErrorAction extends CommonBase { */ public static ErrorAction disconnect_peer(ErrorMessage msg) { long ret = bindings.ErrorAction_disconnect_peer(msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -131,6 +148,18 @@ public class ErrorAction extends CommonBase { */ public static ErrorAction ignore_and_log(org.ldk.enums.Level a) { long ret = bindings.ErrorAction_ignore_and_log(a); + Reference.reachabilityFence(a); + if (ret >= 0 && ret <= 4096) { return null; } + ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction + */ + public static ErrorAction ignore_duplicate_gossip() { + long ret = bindings.ErrorAction_ignore_duplicate_gossip(); if (ret >= 0 && ret <= 4096) { return null; } ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -142,6 +171,7 @@ public class ErrorAction extends CommonBase { */ public static ErrorAction send_error_message(ErrorMessage msg) { long ret = bindings.ErrorAction_send_error_message(msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/ErrorMessage.java b/src/main/java/org/ldk/structs/ErrorMessage.java index cf7b9f50..9199d7fd 100644 --- a/src/main/java/org/ldk/structs/ErrorMessage.java +++ b/src/main/java/org/ldk/structs/ErrorMessage.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ErrorMessage extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.ErrorMessage_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class ErrorMessage extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.ErrorMessage_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class ErrorMessage extends CommonBase { */ public String get_data() { String ret = bindings.ErrorMessage_get_data(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +58,8 @@ public class ErrorMessage extends CommonBase { */ public void set_data(java.lang.String val) { bindings.ErrorMessage_set_data(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -60,6 +67,8 @@ public class ErrorMessage extends CommonBase { */ public static ErrorMessage of(byte[] channel_id_arg, java.lang.String data_arg) { long ret = bindings.ErrorMessage_new(InternalUtils.check_arr_len(channel_id_arg, 32), data_arg); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(data_arg); if (ret >= 0 && ret <= 4096) { return null; } ErrorMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ErrorMessage(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -68,6 +77,7 @@ public class ErrorMessage extends CommonBase { long clone_ptr() { long ret = bindings.ErrorMessage_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -76,6 +86,7 @@ public class ErrorMessage extends CommonBase { */ public ErrorMessage clone() { long ret = bindings.ErrorMessage_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ErrorMessage ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ErrorMessage(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -87,6 +98,7 @@ public class ErrorMessage extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ErrorMessage_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -95,6 +107,7 @@ public class ErrorMessage extends CommonBase { */ public static Result_ErrorMessageDecodeErrorZ read(byte[] ser) { long ret = bindings.ErrorMessage_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ErroringMessageHandler.java b/src/main/java/org/ldk/structs/ErroringMessageHandler.java index 265bb621..05310076 100644 --- a/src/main/java/org/ldk/structs/ErroringMessageHandler.java +++ b/src/main/java/org/ldk/structs/ErroringMessageHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -37,6 +38,7 @@ public class ErroringMessageHandler extends CommonBase { */ public MessageSendEventsProvider as_MessageSendEventsProvider() { long ret = bindings.ErroringMessageHandler_as_MessageSendEventsProvider(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -49,6 +51,7 @@ public class ErroringMessageHandler extends CommonBase { */ public ChannelMessageHandler as_ChannelMessageHandler() { long ret = bindings.ErroringMessageHandler_as_ChannelMessageHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelMessageHandler ret_hu_conv = new ChannelMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Event.java b/src/main/java/org/ldk/structs/Event.java index 06124414..4c608dda 100644 --- a/src/main/java/org/ldk/structs/Event.java +++ b/src/main/java/org/ldk/structs/Event.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -36,6 +37,9 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) { return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) { + return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val); + } if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) { return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val); } @@ -51,15 +55,21 @@ public class Event extends CommonBase { if (raw_val.getClass() == bindings.LDKEvent.DiscardFunding.class) { return new DiscardFunding(ptr, (bindings.LDKEvent.DiscardFunding)raw_val); } + if (raw_val.getClass() == bindings.LDKEvent.PaymentPathSuccessful.class) { + return new PaymentPathSuccessful(ptr, (bindings.LDKEvent.PaymentPathSuccessful)raw_val); + } assert false; return null; // Unreachable without extending the (internal) bindings interface } /** * Used to indicate that the client should generate a funding transaction with the given - * parameters and then call ChannelManager::funding_transaction_generated. - * Generated in ChannelManager message handling. + * parameters and then call [`ChannelManager::funding_transaction_generated`]. + * Generated in [`ChannelManager`] message handling. * Note that *all inputs* in the funding transaction must spend SegWit outputs or your * counterparty can steal your funds! + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ public final static class FundingGenerationReady extends Event { /** @@ -100,12 +110,17 @@ public class Event extends CommonBase { * [`ChannelManager::fail_htlc_backwards`] within the HTLC's timeout, the HTLC will be * automatically failed. * + * # Note + * LDK will not stop an inbound payment from being paid multiple times, so multiple + * `PaymentReceived` events may be generated for the same payment. + * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards */ public final static class PaymentReceived extends Event { /** - * The hash for which the preimage should be handed to the ChannelManager. + * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will + * not stop you from registering duplicate payment hashes for inbound payments. */ public final byte[] payment_hash; /** @@ -152,7 +167,7 @@ public class Event extends CommonBase { */ public final byte[] payment_preimage; /** - * The hash which was given to [`ChannelManager::send_payment`]. + * The hash that was given to [`ChannelManager::send_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ @@ -181,22 +196,30 @@ public class Event extends CommonBase { } } /** - * Indicates an outbound payment we made failed. Probably some intermediary node dropped + * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped * something. You may wish to retry with a different route. + * + * Note that this does *not* indicate that all paths for an MPP payment have failed, see + * [`Event::PaymentFailed`] and [`all_paths_failed`]. + * + * [`all_paths_failed`]: Self::all_paths_failed */ public final static class PaymentPathFailed extends Event { /** * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. + * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ @Nullable public final byte[] payment_id; /** - * The hash which was given to ChannelManager::send_payment. + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ public final byte[] payment_hash; /** @@ -220,6 +243,20 @@ public class Event extends CommonBase { * For both single-path and multi-path payments, this is set if all paths of the payment have * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the * larger MPP payment were still in flight when this event was generated. + * + * Note that if you are retrying individual MPP parts, using this value to determine if a + * payment has fully failed is race-y. Because multiple failures can happen prior to events + * being processed, you may retry in response to a first failure, with a second failure + * (with `all_paths_failed` set) still pending. Then, when the second failure is processed + * you will see `all_paths_failed` set even though the retry of the first failure still + * has an associated in-flight HTLC. See (1) for an example of such a failure. + * + * If you wish to retry individual MPP parts and learn when a payment has failed, you must + * call [`ChannelManager::abandon_payment`] and wait for a [`Event::PaymentFailed`] event. + * + * (1) + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ public final boolean all_paths_failed; /** @@ -274,8 +311,42 @@ public class Event extends CommonBase { } } /** - * Used to indicate that ChannelManager::process_pending_htlc_forwards should be called at a - * time in the future. + * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events + * provide failure information for each MPP part in the payment. + * + * This event is provided once there are no further pending HTLCs for the payment and the + * payment is no longer retryable, either due to a several-block timeout or because + * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + public final static class PaymentFailed extends Event { + /** + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + public final byte[] payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + public final byte[] payment_hash; + private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) { + super(null, ptr); + this.payment_id = obj.payment_id; + this.payment_hash = obj.payment_hash; + } + } + /** + * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at + * a time in the future. + * + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ public final static class PendingHTLCsForwardable extends Event { /** @@ -400,8 +471,53 @@ public class Event extends CommonBase { this.transaction = obj.transaction; } } + /** + * Indicates that a path for an outbound payment was successful. + * + * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See + * [`Event::PaymentSent`] for obtaining the payment preimage. + */ + public final static class PaymentPathSuccessful extends Event { + /** + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment + */ + public final byte[] payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable public final byte[] payment_hash; + /** + * The payment path that was successful. + * + * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. + */ + public final RouteHop[] path; + private PaymentPathSuccessful(long ptr, bindings.LDKEvent.PaymentPathSuccessful obj) { + super(null, ptr); + this.payment_id = obj.payment_id; + this.payment_hash = obj.payment_hash; + long[] path = obj.path; + RouteHop[] path_conv_10_arr = new RouteHop[path.length]; + for (int k = 0; k < path.length; k++) { + long path_conv_10 = path[k]; + RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new RouteHop(null, path_conv_10); } + path_conv_10_hu_conv.ptrs_to.add(this); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + this.path = path_conv_10_arr; + } + } long clone_ptr() { long ret = bindings.Event_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -410,6 +526,7 @@ public class Event extends CommonBase { */ public Event clone() { long ret = bindings.Event_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -421,6 +538,10 @@ public class Event extends CommonBase { */ public static Event funding_generation_ready(byte[] temporary_channel_id, long channel_value_satoshis, byte[] output_script, long user_channel_id) { long ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), channel_value_satoshis, output_script, user_channel_id); + Reference.reachabilityFence(temporary_channel_id); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(output_script); + Reference.reachabilityFence(user_channel_id); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -432,6 +553,9 @@ public class Event extends CommonBase { */ public static Event payment_received(byte[] payment_hash, long amt, PaymentPurpose purpose) { long ret = bindings.Event_payment_received(InternalUtils.check_arr_len(payment_hash, 32), amt, purpose.ptr); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(amt); + Reference.reachabilityFence(purpose); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -443,6 +567,10 @@ public class Event extends CommonBase { */ public static Event payment_sent(byte[] payment_id, byte[] payment_preimage, byte[] payment_hash, Option_u64Z fee_paid_msat) { long ret = bindings.Event_payment_sent(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(payment_preimage); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(fee_paid_msat); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -454,6 +582,27 @@ public class Event extends CommonBase { */ public static Event payment_path_failed(byte[] payment_id, byte[] payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id, RouteParameters retry) { long ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr & ~1); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(rejected_by_dest); + Reference.reachabilityFence(network_update); + Reference.reachabilityFence(all_paths_failed); + Reference.reachabilityFence(path); + Reference.reachabilityFence(short_channel_id); + Reference.reachabilityFence(retry); + if (ret >= 0 && ret <= 4096) { return null; } + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new PaymentFailed-variant Event + */ + public static Event payment_failed(byte[] payment_id, byte[] payment_hash) { + long ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32)); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(payment_hash); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -465,6 +614,7 @@ public class Event extends CommonBase { */ public static Event pending_htlcs_forwardable(long time_forwardable) { long ret = bindings.Event_pending_htlcs_forwardable(time_forwardable); + Reference.reachabilityFence(time_forwardable); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -476,6 +626,7 @@ public class Event extends CommonBase { */ public static Event spendable_outputs(SpendableOutputDescriptor[] outputs) { long ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_27 -> outputs_conv_27.ptr).toArray() : null); + Reference.reachabilityFence(outputs); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -487,6 +638,8 @@ public class Event extends CommonBase { */ public static Event payment_forwarded(Option_u64Z fee_earned_msat, boolean claim_from_onchain_tx) { long ret = bindings.Event_payment_forwarded(fee_earned_msat.ptr, claim_from_onchain_tx); + Reference.reachabilityFence(fee_earned_msat); + Reference.reachabilityFence(claim_from_onchain_tx); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -498,6 +651,9 @@ public class Event extends CommonBase { */ public static Event channel_closed(byte[] channel_id, long user_channel_id, ClosureReason reason) { long ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id, reason.ptr); + Reference.reachabilityFence(channel_id); + Reference.reachabilityFence(user_channel_id); + Reference.reachabilityFence(reason); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -509,6 +665,22 @@ public class Event extends CommonBase { */ public static Event discard_funding(byte[] channel_id, byte[] transaction) { long ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction); + Reference.reachabilityFence(channel_id); + Reference.reachabilityFence(transaction); + if (ret >= 0 && ret <= 4096) { return null; } + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + /** + * Utility method to constructs a new PaymentPathSuccessful-variant Event + */ + public static Event payment_path_successful(byte[] payment_id, byte[] payment_hash, RouteHop[] path) { + long ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null); + Reference.reachabilityFence(payment_id); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(path); if (ret >= 0 && ret <= 4096) { return null; } Event ret_hu_conv = Event.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -520,6 +692,7 @@ public class Event extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Event_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/EventHandler.java b/src/main/java/org/ldk/structs/EventHandler.java index 19f68d36..99a4e5f4 100644 --- a/src/main/java/org/ldk/structs/EventHandler.java +++ b/src/main/java/org/ldk/structs/EventHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -49,6 +50,8 @@ public class EventHandler extends CommonBase { */ public void handle_event(Event event) { bindings.EventHandler_handle_event(this.ptr, event == null ? 0 : event.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(event); } } diff --git a/src/main/java/org/ldk/structs/EventsProvider.java b/src/main/java/org/ldk/structs/EventsProvider.java index 03f8921b..0422859b 100644 --- a/src/main/java/org/ldk/structs/EventsProvider.java +++ b/src/main/java/org/ldk/structs/EventsProvider.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -77,6 +78,8 @@ public class EventsProvider extends CommonBase { */ public void process_pending_events(EventHandler handler) { bindings.EventsProvider_process_pending_events(this.ptr, handler == null ? 0 : handler.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(handler); this.ptrs_to.add(handler); } diff --git a/src/main/java/org/ldk/structs/ExpiryTime.java b/src/main/java/org/ldk/structs/ExpiryTime.java index c476b6c6..ecb2d4c9 100644 --- a/src/main/java/org/ldk/structs/ExpiryTime.java +++ b/src/main/java/org/ldk/structs/ExpiryTime.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class ExpiryTime extends CommonBase { long clone_ptr() { long ret = bindings.ExpiryTime_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -35,6 +37,7 @@ public class ExpiryTime extends CommonBase { */ public ExpiryTime clone() { long ret = bindings.ExpiryTime_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ExpiryTime(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -46,9 +49,13 @@ public class ExpiryTime extends CommonBase { */ public long hash() { long ret = bindings.ExpiryTime_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two ExpiryTimes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -56,10 +63,16 @@ public class ExpiryTime extends CommonBase { */ public boolean eq(ExpiryTime b) { boolean ret = bindings.ExpiryTime_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof ExpiryTime)) return false; + return this.eq((ExpiryTime)o); + } /** * Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would * overflow on adding the `EpiryTime` to it then this function will return a @@ -67,6 +80,7 @@ public class ExpiryTime extends CommonBase { */ public static Result_ExpiryTimeCreationErrorZ from_seconds(long seconds) { long ret = bindings.ExpiryTime_from_seconds(seconds); + Reference.reachabilityFence(seconds); if (ret >= 0 && ret <= 4096) { return null; } Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -79,6 +93,7 @@ public class ExpiryTime extends CommonBase { */ public static Result_ExpiryTimeCreationErrorZ from_duration(long duration) { long ret = bindings.ExpiryTime_from_duration(duration); + Reference.reachabilityFence(duration); if (ret >= 0 && ret <= 4096) { return null; } Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -89,6 +104,7 @@ public class ExpiryTime extends CommonBase { */ public long as_seconds() { long ret = bindings.ExpiryTime_as_seconds(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -97,6 +113,7 @@ public class ExpiryTime extends CommonBase { */ public long as_duration() { long ret = bindings.ExpiryTime_as_duration(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Fallback.java b/src/main/java/org/ldk/structs/Fallback.java index c82d85c1..a94becab 100644 --- a/src/main/java/org/ldk/structs/Fallback.java +++ b/src/main/java/org/ldk/structs/Fallback.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -59,6 +60,7 @@ public class Fallback extends CommonBase { } long clone_ptr() { long ret = bindings.Fallback_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -67,6 +69,7 @@ public class Fallback extends CommonBase { */ public Fallback clone() { long ret = bindings.Fallback_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -78,6 +81,8 @@ public class Fallback extends CommonBase { */ public static Fallback seg_wit_program(UInt5 version, byte[] program) { long ret = bindings.Fallback_seg_wit_program(version.getVal(), program); + Reference.reachabilityFence(version); + Reference.reachabilityFence(program); if (ret >= 0 && ret <= 4096) { return null; } Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -89,6 +94,7 @@ public class Fallback extends CommonBase { */ public static Fallback pub_key_hash(byte[] a) { long ret = bindings.Fallback_pub_key_hash(InternalUtils.check_arr_len(a, 20)); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -100,6 +106,7 @@ public class Fallback extends CommonBase { */ public static Fallback script_hash(byte[] a) { long ret = bindings.Fallback_script_hash(InternalUtils.check_arr_len(a, 20)); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } Fallback ret_hu_conv = Fallback.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -111,16 +118,26 @@ public class Fallback extends CommonBase { */ public long hash() { long ret = bindings.Fallback_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two Fallbacks contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. */ public boolean eq(Fallback b) { boolean ret = bindings.Fallback_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Fallback)) return false; + return this.eq((Fallback)o); + } } diff --git a/src/main/java/org/ldk/structs/FeeEstimator.java b/src/main/java/org/ldk/structs/FeeEstimator.java index bf452b1b..675ae698 100644 --- a/src/main/java/org/ldk/structs/FeeEstimator.java +++ b/src/main/java/org/ldk/structs/FeeEstimator.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -31,12 +32,12 @@ public class FeeEstimator extends CommonBase { /** * Gets estimated satoshis of fee required per 1000 Weight-Units. * - * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs - * don't put us below 1 satoshi-per-byte). + * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later + * round-downs don't put us below 1 satoshi-per-byte). * - * This translates to: - * satoshis-per-byte * 250 - * ceil(satoshis-per-kbyte / 4) + * This method can be implemented with the following unit conversions: + * max(satoshis-per-byte * 250, 253) + * max(satoshis-per-kbyte / 4, 253) */ int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target); } @@ -54,15 +55,17 @@ public class FeeEstimator extends CommonBase { /** * Gets estimated satoshis of fee required per 1000 Weight-Units. * - * Must be no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later round-downs - * don't put us below 1 satoshi-per-byte). + * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later + * round-downs don't put us below 1 satoshi-per-byte). * - * This translates to: - * satoshis-per-byte * 250 - * ceil(satoshis-per-kbyte / 4) + * This method can be implemented with the following unit conversions: + * max(satoshis-per-byte * 250, 253) + * max(satoshis-per-kbyte / 4, 253) */ public int get_est_sat_per_1000_weight(org.ldk.enums.ConfirmationTarget confirmation_target) { int ret = bindings.FeeEstimator_get_est_sat_per_1000_weight(this.ptr, confirmation_target); + Reference.reachabilityFence(this); + Reference.reachabilityFence(confirmation_target); return ret; } diff --git a/src/main/java/org/ldk/structs/FilesystemPersister.java b/src/main/java/org/ldk/structs/FilesystemPersister.java index a3d56328..a274e07b 100644 --- a/src/main/java/org/ldk/structs/FilesystemPersister.java +++ b/src/main/java/org/ldk/structs/FilesystemPersister.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -36,6 +37,7 @@ public class FilesystemPersister extends CommonBase { */ public static FilesystemPersister of(java.lang.String path_to_channel_data) { long ret = bindings.FilesystemPersister_new(path_to_channel_data); + Reference.reachabilityFence(path_to_channel_data); if (ret >= 0 && ret <= 4096) { return null; } FilesystemPersister ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FilesystemPersister(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -47,6 +49,7 @@ public class FilesystemPersister extends CommonBase { */ public String get_data_dir() { String ret = bindings.FilesystemPersister_get_data_dir(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -55,6 +58,8 @@ public class FilesystemPersister extends CommonBase { */ public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ read_channelmonitors(KeysInterface keys_manager) { long ret = bindings.FilesystemPersister_read_channelmonitors(this.ptr, keys_manager == null ? 0 : keys_manager.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(keys_manager); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret); this.ptrs_to.add(keys_manager); @@ -67,6 +72,7 @@ public class FilesystemPersister extends CommonBase { */ public Persist as_Persist() { long ret = bindings.FilesystemPersister_as_Persist(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Persist ret_hu_conv = new Persist(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Filter.java b/src/main/java/org/ldk/structs/Filter.java index 764f2cbb..5503b797 100644 --- a/src/main/java/org/ldk/structs/Filter.java +++ b/src/main/java/org/ldk/structs/Filter.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -84,6 +85,9 @@ public class Filter extends CommonBase { */ public void register_tx(byte[] txid, byte[] script_pubkey) { bindings.Filter_register_tx(this.ptr, InternalUtils.check_arr_len(txid, 32), script_pubkey); + Reference.reachabilityFence(this); + Reference.reachabilityFence(txid); + Reference.reachabilityFence(script_pubkey); } /** @@ -99,6 +103,8 @@ public class Filter extends CommonBase { */ public Option_C2Tuple_usizeTransactionZZ register_output(WatchedOutput output) { long ret = bindings.Filter_register_output(this.ptr, output == null ? 0 : output.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(output); if (ret >= 0 && ret <= 4096) { return null; } Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/FundingCreated.java b/src/main/java/org/ldk/structs/FundingCreated.java index ce30b15f..37168a00 100644 --- a/src/main/java/org/ldk/structs/FundingCreated.java +++ b/src/main/java/org/ldk/structs/FundingCreated.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class FundingCreated extends CommonBase { */ public byte[] get_temporary_channel_id() { byte[] ret = bindings.FundingCreated_get_temporary_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class FundingCreated extends CommonBase { */ public void set_temporary_channel_id(byte[] val) { bindings.FundingCreated_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class FundingCreated extends CommonBase { */ public byte[] get_funding_txid() { byte[] ret = bindings.FundingCreated_get_funding_txid(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class FundingCreated extends CommonBase { */ public void set_funding_txid(byte[] val) { bindings.FundingCreated_set_funding_txid(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class FundingCreated extends CommonBase { */ public short get_funding_output_index() { short ret = bindings.FundingCreated_get_funding_output_index(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class FundingCreated extends CommonBase { */ public void set_funding_output_index(short val) { bindings.FundingCreated_set_funding_output_index(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class FundingCreated extends CommonBase { */ public byte[] get_signature() { byte[] ret = bindings.FundingCreated_get_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class FundingCreated extends CommonBase { */ public void set_signature(byte[] val) { bindings.FundingCreated_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +97,10 @@ public class FundingCreated extends CommonBase { */ public static FundingCreated of(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg) { long ret = bindings.FundingCreated_new(InternalUtils.check_arr_len(temporary_channel_id_arg, 32), InternalUtils.check_arr_len(funding_txid_arg, 32), funding_output_index_arg, InternalUtils.check_arr_len(signature_arg, 64)); + Reference.reachabilityFence(temporary_channel_id_arg); + Reference.reachabilityFence(funding_txid_arg); + Reference.reachabilityFence(funding_output_index_arg); + Reference.reachabilityFence(signature_arg); if (ret >= 0 && ret <= 4096) { return null; } FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingCreated(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -92,6 +109,7 @@ public class FundingCreated extends CommonBase { long clone_ptr() { long ret = bindings.FundingCreated_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -100,6 +118,7 @@ public class FundingCreated extends CommonBase { */ public FundingCreated clone() { long ret = bindings.FundingCreated_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingCreated(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -111,6 +130,7 @@ public class FundingCreated extends CommonBase { */ public byte[] write() { byte[] ret = bindings.FundingCreated_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -119,6 +139,7 @@ public class FundingCreated extends CommonBase { */ public static Result_FundingCreatedDecodeErrorZ read(byte[] ser) { long ret = bindings.FundingCreated_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/FundingLocked.java b/src/main/java/org/ldk/structs/FundingLocked.java index 4aa45f98..faebaa23 100644 --- a/src/main/java/org/ldk/structs/FundingLocked.java +++ b/src/main/java/org/ldk/structs/FundingLocked.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class FundingLocked extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.FundingLocked_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class FundingLocked extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.FundingLocked_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class FundingLocked extends CommonBase { */ public byte[] get_next_per_commitment_point() { byte[] ret = bindings.FundingLocked_get_next_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class FundingLocked extends CommonBase { */ public void set_next_per_commitment_point(byte[] val) { bindings.FundingLocked_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,8 @@ public class FundingLocked extends CommonBase { */ public static FundingLocked of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg) { long ret = bindings.FundingLocked_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33)); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(next_per_commitment_point_arg); if (ret >= 0 && ret <= 4096) { return null; } FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -62,6 +71,7 @@ public class FundingLocked extends CommonBase { long clone_ptr() { long ret = bindings.FundingLocked_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,6 +80,7 @@ public class FundingLocked extends CommonBase { */ public FundingLocked clone() { long ret = bindings.FundingLocked_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } FundingLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingLocked(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -81,6 +92,7 @@ public class FundingLocked extends CommonBase { */ public byte[] write() { byte[] ret = bindings.FundingLocked_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -89,6 +101,7 @@ public class FundingLocked extends CommonBase { */ public static Result_FundingLockedDecodeErrorZ read(byte[] ser) { long ret = bindings.FundingLocked_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingLockedDecodeErrorZ ret_hu_conv = Result_FundingLockedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/FundingSigned.java b/src/main/java/org/ldk/structs/FundingSigned.java index e612f54f..b992038d 100644 --- a/src/main/java/org/ldk/structs/FundingSigned.java +++ b/src/main/java/org/ldk/structs/FundingSigned.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class FundingSigned extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.FundingSigned_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class FundingSigned extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.FundingSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class FundingSigned extends CommonBase { */ public byte[] get_signature() { byte[] ret = bindings.FundingSigned_get_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class FundingSigned extends CommonBase { */ public void set_signature(byte[] val) { bindings.FundingSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,8 @@ public class FundingSigned extends CommonBase { */ public static FundingSigned of(byte[] channel_id_arg, byte[] signature_arg) { long ret = bindings.FundingSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(signature_arg, 64)); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(signature_arg); if (ret >= 0 && ret <= 4096) { return null; } FundingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingSigned(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -62,6 +71,7 @@ public class FundingSigned extends CommonBase { long clone_ptr() { long ret = bindings.FundingSigned_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,6 +80,7 @@ public class FundingSigned extends CommonBase { */ public FundingSigned clone() { long ret = bindings.FundingSigned_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } FundingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new FundingSigned(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -81,6 +92,7 @@ public class FundingSigned extends CommonBase { */ public byte[] write() { byte[] ret = bindings.FundingSigned_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -89,6 +101,7 @@ public class FundingSigned extends CommonBase { */ public static Result_FundingSignedDecodeErrorZ read(byte[] ser) { long ret = bindings.FundingSigned_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/GossipTimestampFilter.java b/src/main/java/org/ldk/structs/GossipTimestampFilter.java index 0e35356b..f6692176 100644 --- a/src/main/java/org/ldk/structs/GossipTimestampFilter.java +++ b/src/main/java/org/ldk/structs/GossipTimestampFilter.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,6 +27,7 @@ public class GossipTimestampFilter extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.GossipTimestampFilter_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -34,6 +36,8 @@ public class GossipTimestampFilter extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.GossipTimestampFilter_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -41,6 +45,7 @@ public class GossipTimestampFilter extends CommonBase { */ public int get_first_timestamp() { int ret = bindings.GossipTimestampFilter_get_first_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +54,8 @@ public class GossipTimestampFilter extends CommonBase { */ public void set_first_timestamp(int val) { bindings.GossipTimestampFilter_set_first_timestamp(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -56,6 +63,7 @@ public class GossipTimestampFilter extends CommonBase { */ public int get_timestamp_range() { int ret = bindings.GossipTimestampFilter_get_timestamp_range(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -64,6 +72,8 @@ public class GossipTimestampFilter extends CommonBase { */ public void set_timestamp_range(int val) { bindings.GossipTimestampFilter_set_timestamp_range(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -71,6 +81,9 @@ public class GossipTimestampFilter extends CommonBase { */ public static GossipTimestampFilter of(byte[] chain_hash_arg, int first_timestamp_arg, int timestamp_range_arg) { long ret = bindings.GossipTimestampFilter_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_timestamp_arg, timestamp_range_arg); + Reference.reachabilityFence(chain_hash_arg); + Reference.reachabilityFence(first_timestamp_arg); + Reference.reachabilityFence(timestamp_range_arg); if (ret >= 0 && ret <= 4096) { return null; } GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -79,6 +92,7 @@ public class GossipTimestampFilter extends CommonBase { long clone_ptr() { long ret = bindings.GossipTimestampFilter_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -87,6 +101,7 @@ public class GossipTimestampFilter extends CommonBase { */ public GossipTimestampFilter clone() { long ret = bindings.GossipTimestampFilter_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } GossipTimestampFilter ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new GossipTimestampFilter(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -98,6 +113,7 @@ public class GossipTimestampFilter extends CommonBase { */ public byte[] write() { byte[] ret = bindings.GossipTimestampFilter_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -106,6 +122,7 @@ public class GossipTimestampFilter extends CommonBase { */ public static Result_GossipTimestampFilterDecodeErrorZ read(byte[] ser) { long ret = bindings.GossipTimestampFilter_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java index 9eff5b40..87aa7f55 100644 --- a/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java +++ b/src/main/java/org/ldk/structs/HTLCOutputInCommitment.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public boolean get_offered() { boolean ret = bindings.HTLCOutputInCommitment_get_offered(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -38,6 +40,8 @@ public class HTLCOutputInCommitment extends CommonBase { */ public void set_offered(boolean val) { bindings.HTLCOutputInCommitment_set_offered(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -46,6 +50,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public long get_amount_msat() { long ret = bindings.HTLCOutputInCommitment_get_amount_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -55,6 +60,8 @@ public class HTLCOutputInCommitment extends CommonBase { */ public void set_amount_msat(long val) { bindings.HTLCOutputInCommitment_set_amount_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -62,6 +69,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public int get_cltv_expiry() { int ret = bindings.HTLCOutputInCommitment_get_cltv_expiry(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,6 +78,8 @@ public class HTLCOutputInCommitment extends CommonBase { */ public void set_cltv_expiry(int val) { bindings.HTLCOutputInCommitment_set_cltv_expiry(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -77,6 +87,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public byte[] get_payment_hash() { byte[] ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -85,6 +96,8 @@ public class HTLCOutputInCommitment extends CommonBase { */ public void set_payment_hash(byte[] val) { bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -94,6 +107,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public Option_u32Z get_transaction_output_index() { long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -107,6 +121,8 @@ public class HTLCOutputInCommitment extends CommonBase { */ public void set_transaction_output_index(Option_u32Z val) { bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -114,6 +130,11 @@ public class HTLCOutputInCommitment extends CommonBase { */ public static HTLCOutputInCommitment of(boolean offered_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, Option_u32Z transaction_output_index_arg) { long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, InternalUtils.check_arr_len(payment_hash_arg, 32), transaction_output_index_arg.ptr); + Reference.reachabilityFence(offered_arg); + Reference.reachabilityFence(amount_msat_arg); + Reference.reachabilityFence(cltv_expiry_arg); + Reference.reachabilityFence(payment_hash_arg); + Reference.reachabilityFence(transaction_output_index_arg); if (ret >= 0 && ret <= 4096) { return null; } HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new HTLCOutputInCommitment(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -122,6 +143,7 @@ public class HTLCOutputInCommitment extends CommonBase { long clone_ptr() { long ret = bindings.HTLCOutputInCommitment_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -130,6 +152,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public HTLCOutputInCommitment clone() { long ret = bindings.HTLCOutputInCommitment_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } HTLCOutputInCommitment ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new HTLCOutputInCommitment(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -141,6 +164,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public byte[] write() { byte[] ret = bindings.HTLCOutputInCommitment_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -149,6 +173,7 @@ public class HTLCOutputInCommitment extends CommonBase { */ public static Result_HTLCOutputInCommitmentDecodeErrorZ read(byte[] ser) { long ret = bindings.HTLCOutputInCommitment_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/HTLCUpdate.java b/src/main/java/org/ldk/structs/HTLCUpdate.java index c15590f4..96789c0a 100644 --- a/src/main/java/org/ldk/structs/HTLCUpdate.java +++ b/src/main/java/org/ldk/structs/HTLCUpdate.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -23,6 +24,7 @@ public class HTLCUpdate extends CommonBase { long clone_ptr() { long ret = bindings.HTLCUpdate_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -31,6 +33,7 @@ public class HTLCUpdate extends CommonBase { */ public HTLCUpdate clone() { long ret = bindings.HTLCUpdate_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } HTLCUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new HTLCUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -42,6 +45,7 @@ public class HTLCUpdate extends CommonBase { */ public byte[] write() { byte[] ret = bindings.HTLCUpdate_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +54,7 @@ public class HTLCUpdate extends CommonBase { */ public static Result_HTLCUpdateDecodeErrorZ read(byte[] ser) { long ret = bindings.HTLCUpdate_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java b/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java index 23716acf..c37903dc 100644 --- a/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/HolderCommitmentTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,6 +27,7 @@ public class HolderCommitmentTransaction extends CommonBase { */ public byte[] get_counterparty_sig() { byte[] ret = bindings.HolderCommitmentTransaction_get_counterparty_sig(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -34,6 +36,8 @@ public class HolderCommitmentTransaction extends CommonBase { */ public void set_counterparty_sig(byte[] val) { bindings.HolderCommitmentTransaction_set_counterparty_sig(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -41,10 +45,13 @@ public class HolderCommitmentTransaction extends CommonBase { */ public void set_counterparty_htlc_sigs(byte[][] val) { bindings.HolderCommitmentTransaction_set_counterparty_htlc_sigs(this.ptr, val != null ? Arrays.stream(val).map(val_conv_8 -> InternalUtils.check_arr_len(val_conv_8, 64)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.HolderCommitmentTransaction_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +60,7 @@ public class HolderCommitmentTransaction extends CommonBase { */ public HolderCommitmentTransaction clone() { long ret = bindings.HolderCommitmentTransaction_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } HolderCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new HolderCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -64,6 +72,7 @@ public class HolderCommitmentTransaction extends CommonBase { */ public byte[] write() { byte[] ret = bindings.HolderCommitmentTransaction_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +81,7 @@ public class HolderCommitmentTransaction extends CommonBase { */ public static Result_HolderCommitmentTransactionDecodeErrorZ read(byte[] ser) { long ret = bindings.HolderCommitmentTransaction_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -83,6 +93,11 @@ public class HolderCommitmentTransaction extends CommonBase { */ public static HolderCommitmentTransaction of(CommitmentTransaction commitment_tx, byte[] counterparty_sig, byte[][] counterparty_htlc_sigs, byte[] holder_funding_key, byte[] counterparty_funding_key) { long ret = bindings.HolderCommitmentTransaction_new(commitment_tx == null ? 0 : commitment_tx.ptr & ~1, InternalUtils.check_arr_len(counterparty_sig, 64), counterparty_htlc_sigs != null ? Arrays.stream(counterparty_htlc_sigs).map(counterparty_htlc_sigs_conv_8 -> InternalUtils.check_arr_len(counterparty_htlc_sigs_conv_8, 64)).toArray(byte[][]::new) : null, InternalUtils.check_arr_len(holder_funding_key, 33), InternalUtils.check_arr_len(counterparty_funding_key, 33)); + Reference.reachabilityFence(commitment_tx); + Reference.reachabilityFence(counterparty_sig); + Reference.reachabilityFence(counterparty_htlc_sigs); + Reference.reachabilityFence(holder_funding_key); + Reference.reachabilityFence(counterparty_funding_key); if (ret >= 0 && ret <= 4096) { return null; } HolderCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new HolderCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/IgnoringMessageHandler.java b/src/main/java/org/ldk/structs/IgnoringMessageHandler.java index a45a45db..cfee35fe 100644 --- a/src/main/java/org/ldk/structs/IgnoringMessageHandler.java +++ b/src/main/java/org/ldk/structs/IgnoringMessageHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -37,6 +38,7 @@ public class IgnoringMessageHandler extends CommonBase { */ public MessageSendEventsProvider as_MessageSendEventsProvider() { long ret = bindings.IgnoringMessageHandler_as_MessageSendEventsProvider(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -49,6 +51,7 @@ public class IgnoringMessageHandler extends CommonBase { */ public RoutingMessageHandler as_RoutingMessageHandler() { long ret = bindings.IgnoringMessageHandler_as_RoutingMessageHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -61,6 +64,7 @@ public class IgnoringMessageHandler extends CommonBase { */ public CustomMessageReader as_CustomMessageReader() { long ret = bindings.IgnoringMessageHandler_as_CustomMessageReader(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CustomMessageReader ret_hu_conv = new CustomMessageReader(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -73,6 +77,7 @@ public class IgnoringMessageHandler extends CommonBase { */ public CustomMessageHandler as_CustomMessageHandler() { long ret = bindings.IgnoringMessageHandler_as_CustomMessageHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } CustomMessageHandler ret_hu_conv = new CustomMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/InMemorySigner.java b/src/main/java/org/ldk/structs/InMemorySigner.java index 5b4b67bc..031985ff 100644 --- a/src/main/java/org/ldk/structs/InMemorySigner.java +++ b/src/main/java/org/ldk/structs/InMemorySigner.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] get_funding_key() { byte[] ret = bindings.InMemorySigner_get_funding_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -35,6 +37,8 @@ public class InMemorySigner extends CommonBase { */ public void set_funding_key(byte[] val) { bindings.InMemorySigner_set_funding_key(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] get_revocation_base_key() { byte[] ret = bindings.InMemorySigner_get_revocation_base_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class InMemorySigner extends CommonBase { */ public void set_revocation_base_key(byte[] val) { bindings.InMemorySigner_set_revocation_base_key(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] get_payment_key() { byte[] ret = bindings.InMemorySigner_get_payment_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -65,6 +73,8 @@ public class InMemorySigner extends CommonBase { */ public void set_payment_key(byte[] val) { bindings.InMemorySigner_set_payment_key(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +82,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] get_delayed_payment_base_key() { byte[] ret = bindings.InMemorySigner_get_delayed_payment_base_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +91,8 @@ public class InMemorySigner extends CommonBase { */ public void set_delayed_payment_base_key(byte[] val) { bindings.InMemorySigner_set_delayed_payment_base_key(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -87,6 +100,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] get_htlc_base_key() { byte[] ret = bindings.InMemorySigner_get_htlc_base_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -95,6 +109,8 @@ public class InMemorySigner extends CommonBase { */ public void set_htlc_base_key(byte[] val) { bindings.InMemorySigner_set_htlc_base_key(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -102,6 +118,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] get_commitment_seed() { byte[] ret = bindings.InMemorySigner_get_commitment_seed(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -110,10 +127,13 @@ public class InMemorySigner extends CommonBase { */ public void set_commitment_seed(byte[] val) { bindings.InMemorySigner_set_commitment_seed(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.InMemorySigner_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -122,6 +142,7 @@ public class InMemorySigner extends CommonBase { */ public InMemorySigner clone() { long ret = bindings.InMemorySigner_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -133,6 +154,14 @@ public class InMemorySigner extends CommonBase { */ public static InMemorySigner of(byte[] funding_key, byte[] revocation_base_key, byte[] payment_key, byte[] delayed_payment_base_key, byte[] htlc_base_key, byte[] commitment_seed, long channel_value_satoshis, byte[] channel_keys_id) { long ret = bindings.InMemorySigner_new(InternalUtils.check_arr_len(funding_key, 32), InternalUtils.check_arr_len(revocation_base_key, 32), InternalUtils.check_arr_len(payment_key, 32), InternalUtils.check_arr_len(delayed_payment_base_key, 32), InternalUtils.check_arr_len(htlc_base_key, 32), InternalUtils.check_arr_len(commitment_seed, 32), channel_value_satoshis, InternalUtils.check_arr_len(channel_keys_id, 32)); + Reference.reachabilityFence(funding_key); + Reference.reachabilityFence(revocation_base_key); + Reference.reachabilityFence(payment_key); + Reference.reachabilityFence(delayed_payment_base_key); + Reference.reachabilityFence(htlc_base_key); + Reference.reachabilityFence(commitment_seed); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(channel_keys_id); if (ret >= 0 && ret <= 4096) { return null; } InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -145,6 +174,7 @@ public class InMemorySigner extends CommonBase { */ public ChannelPublicKeys counterparty_pubkeys() { long ret = bindings.InMemorySigner_counterparty_pubkeys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -159,6 +189,7 @@ public class InMemorySigner extends CommonBase { */ public short counterparty_selected_contest_delay() { short ret = bindings.InMemorySigner_counterparty_selected_contest_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -170,6 +201,7 @@ public class InMemorySigner extends CommonBase { */ public short holder_selected_contest_delay() { short ret = bindings.InMemorySigner_holder_selected_contest_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -179,6 +211,7 @@ public class InMemorySigner extends CommonBase { */ public boolean is_outbound() { boolean ret = bindings.InMemorySigner_is_outbound(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -188,6 +221,7 @@ public class InMemorySigner extends CommonBase { */ public OutPoint funding_outpoint() { long ret = bindings.InMemorySigner_funding_outpoint(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -202,12 +236,23 @@ public class InMemorySigner extends CommonBase { */ public ChannelTransactionParameters get_channel_parameters() { long ret = bindings.InMemorySigner_get_channel_parameters(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTransactionParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Whether anchors should be used. + * Will panic if ready_channel wasn't called. + */ + public boolean opt_anchors() { + boolean ret = bindings.InMemorySigner_opt_anchors(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Sign the single input of spend_tx at index `input_idx` which spends the output * described by descriptor, returning the witness stack for the input. @@ -217,6 +262,10 @@ public class InMemorySigner extends CommonBase { */ public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(byte[] spend_tx, long input_idx, StaticPaymentOutputDescriptor descriptor) { long ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(spend_tx); + Reference.reachabilityFence(input_idx); + Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(descriptor); @@ -233,6 +282,10 @@ public class InMemorySigner extends CommonBase { */ public Result_CVec_CVec_u8ZZNoneZ sign_dynamic_p2wsh_input(byte[] spend_tx, long input_idx, DelayedPaymentOutputDescriptor descriptor) { long ret = bindings.InMemorySigner_sign_dynamic_p2wsh_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(spend_tx); + Reference.reachabilityFence(input_idx); + Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(descriptor); @@ -245,6 +298,7 @@ public class InMemorySigner extends CommonBase { */ public BaseSign as_BaseSign() { long ret = bindings.InMemorySigner_as_BaseSign(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BaseSign ret_hu_conv = new BaseSign(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -257,6 +311,7 @@ public class InMemorySigner extends CommonBase { */ public Sign as_Sign() { long ret = bindings.InMemorySigner_as_Sign(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Sign ret_hu_conv = new Sign(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -268,6 +323,7 @@ public class InMemorySigner extends CommonBase { */ public byte[] write() { byte[] ret = bindings.InMemorySigner_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -276,6 +332,7 @@ public class InMemorySigner extends CommonBase { */ public static Result_InMemorySignerDecodeErrorZ read(byte[] ser) { long ret = bindings.InMemorySigner_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Init.java b/src/main/java/org/ldk/structs/Init.java index c108fd98..fd91adc0 100644 --- a/src/main/java/org/ldk/structs/Init.java +++ b/src/main/java/org/ldk/structs/Init.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class Init extends CommonBase { */ public InitFeatures get_features() { long ret = bindings.Init_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,8 @@ public class Init extends CommonBase { */ public void set_features(InitFeatures val) { bindings.Init_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class Init extends CommonBase { */ public static Init of(InitFeatures features_arg) { long ret = bindings.Init_new(features_arg == null ? 0 : features_arg.ptr & ~1); + Reference.reachabilityFence(features_arg); if (ret >= 0 && ret <= 4096) { return null; } Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -50,6 +55,7 @@ public class Init extends CommonBase { long clone_ptr() { long ret = bindings.Init_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -58,6 +64,7 @@ public class Init extends CommonBase { */ public Init clone() { long ret = bindings.Init_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Init ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Init(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -69,6 +76,7 @@ public class Init extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Init_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +85,7 @@ public class Init extends CommonBase { */ public static Result_InitDecodeErrorZ read(byte[] ser) { long ret = bindings.Init_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/InitFeatures.java b/src/main/java/org/ldk/structs/InitFeatures.java index cdc9a58b..1c4cee2d 100644 --- a/src/main/java/org/ldk/structs/InitFeatures.java +++ b/src/main/java/org/ldk/structs/InitFeatures.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,12 +27,19 @@ public class InitFeatures extends CommonBase { */ public boolean eq(InitFeatures b) { boolean ret = bindings.InitFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof InitFeatures)) return false; + return this.eq((InitFeatures)o); + } long clone_ptr() { long ret = bindings.InitFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -40,6 +48,7 @@ public class InitFeatures extends CommonBase { */ public InitFeatures clone() { long ret = bindings.InitFeatures_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InitFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -74,14 +83,7 @@ public class InitFeatures extends CommonBase { */ public boolean requires_unknown_bits() { boolean ret = bindings.InitFeatures_requires_unknown_bits(this.ptr); - return ret; - } - - /** - * Returns whether the `payment_secret` feature is supported. - */ - public boolean supports_payment_secret() { - boolean ret = bindings.InitFeatures_supports_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -90,6 +92,7 @@ public class InitFeatures extends CommonBase { */ public byte[] write() { byte[] ret = bindings.InitFeatures_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -98,6 +101,7 @@ public class InitFeatures extends CommonBase { */ public static Result_InitFeaturesDecodeErrorZ read(byte[] ser) { long ret = bindings.InitFeatures_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/InvalidShutdownScript.java b/src/main/java/org/ldk/structs/InvalidShutdownScript.java index 89b502bc..74bbc19c 100644 --- a/src/main/java/org/ldk/structs/InvalidShutdownScript.java +++ b/src/main/java/org/ldk/structs/InvalidShutdownScript.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,6 +27,7 @@ public class InvalidShutdownScript extends CommonBase { */ public byte[] get_script() { byte[] ret = bindings.InvalidShutdownScript_get_script(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -36,6 +38,8 @@ public class InvalidShutdownScript extends CommonBase { */ public void set_script(byte[] val) { bindings.InvalidShutdownScript_set_script(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,7 @@ public class InvalidShutdownScript extends CommonBase { */ public static InvalidShutdownScript of(byte[] script_arg) { long ret = bindings.InvalidShutdownScript_new(script_arg); + Reference.reachabilityFence(script_arg); if (ret >= 0 && ret <= 4096) { return null; } InvalidShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvalidShutdownScript(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -51,6 +56,7 @@ public class InvalidShutdownScript extends CommonBase { long clone_ptr() { long ret = bindings.InvalidShutdownScript_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -59,6 +65,7 @@ public class InvalidShutdownScript extends CommonBase { */ public InvalidShutdownScript clone() { long ret = bindings.InvalidShutdownScript_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvalidShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvalidShutdownScript(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Invoice.java b/src/main/java/org/ldk/structs/Invoice.java index 8817ed41..5b02d9eb 100644 --- a/src/main/java/org/ldk/structs/Invoice.java +++ b/src/main/java/org/ldk/structs/Invoice.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -31,12 +32,19 @@ public class Invoice extends CommonBase { */ public boolean eq(Invoice b) { boolean ret = bindings.Invoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Invoice)) return false; + return this.eq((Invoice)o); + } long clone_ptr() { long ret = bindings.Invoice_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -45,6 +53,7 @@ public class Invoice extends CommonBase { */ public Invoice clone() { long ret = bindings.Invoice_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Invoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Invoice(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -56,6 +65,7 @@ public class Invoice extends CommonBase { */ public SignedRawInvoice into_signed_raw() { long ret = bindings.Invoice_into_signed_raw(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } SignedRawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new SignedRawInvoice(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -68,6 +78,7 @@ public class Invoice extends CommonBase { */ public Result_NoneSemanticErrorZ check_signature() { long ret = bindings.Invoice_check_signature(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -97,6 +108,7 @@ public class Invoice extends CommonBase { */ public static Result_InvoiceSemanticErrorZ from_signed(SignedRawInvoice signed_invoice) { long ret = bindings.Invoice_from_signed(signed_invoice == null ? 0 : signed_invoice.ptr & ~1); + Reference.reachabilityFence(signed_invoice); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -107,6 +119,7 @@ public class Invoice extends CommonBase { */ public long timestamp() { long ret = bindings.Invoice_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -115,6 +128,7 @@ public class Invoice extends CommonBase { */ public byte[] payment_hash() { byte[] ret = bindings.Invoice_payment_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -126,6 +140,7 @@ public class Invoice extends CommonBase { @Nullable public byte[] payee_pub_key() { byte[] ret = bindings.Invoice_payee_pub_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -134,6 +149,7 @@ public class Invoice extends CommonBase { */ public byte[] payment_secret() { byte[] ret = bindings.Invoice_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -145,6 +161,7 @@ public class Invoice extends CommonBase { @Nullable public InvoiceFeatures features() { long ret = bindings.Invoice_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -156,6 +173,7 @@ public class Invoice extends CommonBase { */ public byte[] recover_payee_pub_key() { byte[] ret = bindings.Invoice_recover_payee_pub_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -164,6 +182,7 @@ public class Invoice extends CommonBase { */ public long expiry_time() { long ret = bindings.Invoice_expiry_time(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -172,6 +191,7 @@ public class Invoice extends CommonBase { */ public boolean is_expired() { boolean ret = bindings.Invoice_is_expired(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -181,6 +201,7 @@ public class Invoice extends CommonBase { */ public long min_final_cltv_expiry() { long ret = bindings.Invoice_min_final_cltv_expiry(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -189,6 +210,7 @@ public class Invoice extends CommonBase { */ public PrivateRoute[] private_routes() { long[] ret = bindings.Invoice_private_routes(this.ptr); + Reference.reachabilityFence(this); PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length]; for (int o = 0; o < ret.length; o++) { long ret_conv_14 = ret[o]; @@ -204,6 +226,7 @@ public class Invoice extends CommonBase { */ public RouteHint[] route_hints() { long[] ret = bindings.Invoice_route_hints(this.ptr); + Reference.reachabilityFence(this); RouteHint[] ret_conv_11_arr = new RouteHint[ret.length]; for (int l = 0; l < ret.length; l++) { long ret_conv_11 = ret[l]; @@ -219,6 +242,7 @@ public class Invoice extends CommonBase { */ public Currency currency() { Currency ret = bindings.Invoice_currency(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -227,6 +251,7 @@ public class Invoice extends CommonBase { */ public Option_u64Z amount_milli_satoshis() { long ret = bindings.Invoice_amount_milli_satoshis(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -238,6 +263,7 @@ public class Invoice extends CommonBase { */ public static Result_InvoiceNoneZ from_str(java.lang.String s) { long ret = bindings.Invoice_from_str(s); + Reference.reachabilityFence(s); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -248,6 +274,7 @@ public class Invoice extends CommonBase { */ public String to_str() { String ret = bindings.Invoice_to_str(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/InvoiceFeatures.java b/src/main/java/org/ldk/structs/InvoiceFeatures.java index 6d075ce9..31bb70d1 100644 --- a/src/main/java/org/ldk/structs/InvoiceFeatures.java +++ b/src/main/java/org/ldk/structs/InvoiceFeatures.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,12 +27,19 @@ public class InvoiceFeatures extends CommonBase { */ public boolean eq(InvoiceFeatures b) { boolean ret = bindings.InvoiceFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof InvoiceFeatures)) return false; + return this.eq((InvoiceFeatures)o); + } long clone_ptr() { long ret = bindings.InvoiceFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -40,6 +48,7 @@ public class InvoiceFeatures extends CommonBase { */ public InvoiceFeatures clone() { long ret = bindings.InvoiceFeatures_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -74,14 +83,7 @@ public class InvoiceFeatures extends CommonBase { */ public boolean requires_unknown_bits() { boolean ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr); - return ret; - } - - /** - * Returns whether the `payment_secret` feature is supported. - */ - public boolean supports_payment_secret() { - boolean ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -90,6 +92,7 @@ public class InvoiceFeatures extends CommonBase { */ public byte[] write() { byte[] ret = bindings.InvoiceFeatures_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -98,6 +101,7 @@ public class InvoiceFeatures extends CommonBase { */ public static Result_InvoiceFeaturesDecodeErrorZ read(byte[] ser) { long ret = bindings.InvoiceFeatures_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/InvoicePayer.java b/src/main/java/org/ldk/structs/InvoicePayer.java index a54ee10b..d8a7022e 100644 --- a/src/main/java/org/ldk/structs/InvoicePayer.java +++ b/src/main/java/org/ldk/structs/InvoicePayer.java @@ -4,11 +4,16 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** - * A utility for paying [`Invoice]`s. + * A utility for paying [`Invoice`]s and sending spontaneous payments. + * + * See [module-level documentation] for details. + * + * [module-level documentation]: crate::payment */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class InvoicePayer extends CommonBase { @@ -25,8 +30,14 @@ public class InvoicePayer extends CommonBase { * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once * `retry_attempts` has been exceeded for a given [`Invoice`]. */ - public static InvoicePayer of(Payer payer, Router router, LockableScore scorer, Logger logger, EventHandler event_handler, RetryAttempts retry_attempts) { + public static InvoicePayer of(Payer payer, Router router, MultiThreadedLockableScore scorer, Logger logger, EventHandler event_handler, RetryAttempts retry_attempts) { long ret = bindings.InvoicePayer_new(payer == null ? 0 : payer.ptr, router == null ? 0 : router.ptr, scorer == null ? 0 : scorer.ptr & ~1, logger == null ? 0 : logger.ptr, event_handler == null ? 0 : event_handler.ptr, retry_attempts == null ? 0 : retry_attempts.ptr & ~1); + Reference.reachabilityFence(payer); + Reference.reachabilityFence(router); + Reference.reachabilityFence(scorer); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(event_handler); + Reference.reachabilityFence(retry_attempts); if (ret >= 0 && ret <= 4096) { return null; } InvoicePayer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoicePayer(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -47,6 +58,8 @@ public class InvoicePayer extends CommonBase { */ public Result_PaymentIdPaymentErrorZ pay_invoice(Invoice invoice) { long ret = bindings.InvoicePayer_pay_invoice(this.ptr, invoice == null ? 0 : invoice.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(invoice); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); this.ptrs_to.add(invoice); @@ -63,12 +76,34 @@ public class InvoicePayer extends CommonBase { */ public Result_PaymentIdPaymentErrorZ pay_zero_value_invoice(Invoice invoice, long amount_msats) { long ret = bindings.InvoicePayer_pay_zero_value_invoice(this.ptr, invoice == null ? 0 : invoice.ptr & ~1, amount_msats); + Reference.reachabilityFence(this); + Reference.reachabilityFence(invoice); + Reference.reachabilityFence(amount_msats); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); this.ptrs_to.add(invoice); return ret_hu_conv; } + /** + * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in + * case a retry is needed. + * + * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never + * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you. + */ + public Result_PaymentIdPaymentErrorZ pay_pubkey(byte[] pubkey, byte[] payment_preimage, long amount_msats, int final_cltv_expiry_delta) { + long ret = bindings.InvoicePayer_pay_pubkey(this.ptr, InternalUtils.check_arr_len(pubkey, 33), InternalUtils.check_arr_len(payment_preimage, 32), amount_msats, final_cltv_expiry_delta); + Reference.reachabilityFence(this); + Reference.reachabilityFence(pubkey); + Reference.reachabilityFence(payment_preimage); + Reference.reachabilityFence(amount_msats); + Reference.reachabilityFence(final_cltv_expiry_delta); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + /** * Removes the payment cached by the given payment hash. * @@ -77,6 +112,8 @@ public class InvoicePayer extends CommonBase { */ public void remove_cached_payment(byte[] payment_hash) { bindings.InvoicePayer_remove_cached_payment(this.ptr, InternalUtils.check_arr_len(payment_hash, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_hash); } /** @@ -85,6 +122,7 @@ public class InvoicePayer extends CommonBase { */ public EventHandler as_EventHandler() { long ret = bindings.InvoicePayer_as_EventHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } EventHandler ret_hu_conv = new EventHandler(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/InvoiceSignature.java b/src/main/java/org/ldk/structs/InvoiceSignature.java index c6f75910..0d176c69 100644 --- a/src/main/java/org/ldk/structs/InvoiceSignature.java +++ b/src/main/java/org/ldk/structs/InvoiceSignature.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class InvoiceSignature extends CommonBase { long clone_ptr() { long ret = bindings.InvoiceSignature_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class InvoiceSignature extends CommonBase { */ public InvoiceSignature clone() { long ret = bindings.InvoiceSignature_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceSignature ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceSignature(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -42,8 +45,14 @@ public class InvoiceSignature extends CommonBase { */ public boolean eq(InvoiceSignature b) { boolean ret = bindings.InvoiceSignature_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof InvoiceSignature)) return false; + return this.eq((InvoiceSignature)o); + } } diff --git a/src/main/java/org/ldk/structs/KeysInterface.java b/src/main/java/org/ldk/structs/KeysInterface.java index e4c8e486..f9d70fce 100644 --- a/src/main/java/org/ldk/structs/KeysInterface.java +++ b/src/main/java/org/ldk/structs/KeysInterface.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -75,6 +76,12 @@ public class KeysInterface extends CommonBase { * blindly signing the hash. */ Result_RecoverableSignatureNoneZ sign_invoice(byte[] invoice_preimage); + /** + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * + * This method must return the same value each time it is called. + */ + byte[] get_inbound_payment_key_material(); } private static class LDKKeysInterfaceHolder { KeysInterface held; } public static KeysInterface new_impl(KeysInterfaceInterface arg) { @@ -115,6 +122,11 @@ public class KeysInterface extends CommonBase { long result = ret == null ? 0 : ret.clone_ptr(); return result; } + @Override public byte[] get_inbound_payment_key_material() { + byte[] ret = arg.get_inbound_payment_key_material(); + byte[] result = InternalUtils.check_arr_len(ret, 32); + return result; + } }); return impl_holder.held; } @@ -125,6 +137,7 @@ public class KeysInterface extends CommonBase { */ public byte[] get_node_secret() { byte[] ret = bindings.KeysInterface_get_node_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -136,6 +149,7 @@ public class KeysInterface extends CommonBase { */ public byte[] get_destination_script() { byte[] ret = bindings.KeysInterface_get_destination_script(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -147,6 +161,7 @@ public class KeysInterface extends CommonBase { */ public ShutdownScript get_shutdown_scriptpubkey() { long ret = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ShutdownScript(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -161,6 +176,9 @@ public class KeysInterface extends CommonBase { */ public Sign get_channel_signer(boolean inbound, long channel_value_satoshis) { long ret = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis); + Reference.reachabilityFence(this); + Reference.reachabilityFence(inbound); + Reference.reachabilityFence(channel_value_satoshis); if (ret >= 0 && ret <= 4096) { return null; } Sign ret_hu_conv = new Sign(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -176,6 +194,7 @@ public class KeysInterface extends CommonBase { */ public byte[] get_secure_random_bytes() { byte[] ret = bindings.KeysInterface_get_secure_random_bytes(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -189,6 +208,8 @@ public class KeysInterface extends CommonBase { */ public Result_SignDecodeErrorZ read_chan_signer(byte[] reader) { long ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader); + Reference.reachabilityFence(this); + Reference.reachabilityFence(reader); if (ret >= 0 && ret <= 4096) { return null; } Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -202,9 +223,22 @@ public class KeysInterface extends CommonBase { */ public Result_RecoverableSignatureNoneZ sign_invoice(byte[] invoice_preimage) { long ret = bindings.KeysInterface_sign_invoice(this.ptr, invoice_preimage); + Reference.reachabilityFence(this); + Reference.reachabilityFence(invoice_preimage); if (ret >= 0 && ret <= 4096) { return null; } Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; } + /** + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * + * This method must return the same value each time it is called. + */ + public byte[] get_inbound_payment_key_material() { + byte[] ret = bindings.KeysInterface_get_inbound_payment_key_material(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + } diff --git a/src/main/java/org/ldk/structs/KeysManager.java b/src/main/java/org/ldk/structs/KeysManager.java index 25107f06..0876219e 100644 --- a/src/main/java/org/ldk/structs/KeysManager.java +++ b/src/main/java/org/ldk/structs/KeysManager.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -48,6 +49,9 @@ public class KeysManager extends CommonBase { */ public static KeysManager of(byte[] seed, long starting_time_secs, int starting_time_nanos) { long ret = bindings.KeysManager_new(InternalUtils.check_arr_len(seed, 32), starting_time_secs, starting_time_nanos); + Reference.reachabilityFence(seed); + Reference.reachabilityFence(starting_time_secs); + Reference.reachabilityFence(starting_time_nanos); if (ret >= 0 && ret <= 4096) { return null; } KeysManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new KeysManager(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -63,6 +67,9 @@ public class KeysManager extends CommonBase { */ public InMemorySigner derive_channel_keys(long channel_value_satoshis, byte[] params) { long ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, InternalUtils.check_arr_len(params, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_value_satoshis); + Reference.reachabilityFence(params); if (ret >= 0 && ret <= 4096) { return null; } InMemorySigner ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InMemorySigner(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -84,6 +91,11 @@ public class KeysManager extends CommonBase { */ public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight) { long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight); + Reference.reachabilityFence(this); + Reference.reachabilityFence(descriptors); + Reference.reachabilityFence(outputs); + Reference.reachabilityFence(change_destination_script); + Reference.reachabilityFence(feerate_sat_per_1000_weight); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -95,6 +107,7 @@ public class KeysManager extends CommonBase { */ public KeysInterface as_KeysInterface() { long ret = bindings.KeysManager_as_KeysInterface(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } KeysInterface ret_hu_conv = new KeysInterface(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/LightningError.java b/src/main/java/org/ldk/structs/LightningError.java index 74702588..6c511c7f 100644 --- a/src/main/java/org/ldk/structs/LightningError.java +++ b/src/main/java/org/ldk/structs/LightningError.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class LightningError extends CommonBase { */ public String get_err() { String ret = bindings.LightningError_get_err(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class LightningError extends CommonBase { */ public void set_err(java.lang.String val) { bindings.LightningError_set_err(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class LightningError extends CommonBase { */ public ErrorAction get_action() { long ret = bindings.LightningError_get_action(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -50,6 +55,8 @@ public class LightningError extends CommonBase { */ public void set_action(ErrorAction val) { bindings.LightningError_set_action(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,8 @@ public class LightningError extends CommonBase { */ public static LightningError of(java.lang.String err_arg, ErrorAction action_arg) { long ret = bindings.LightningError_new(err_arg, action_arg.ptr); + Reference.reachabilityFence(err_arg); + Reference.reachabilityFence(action_arg); if (ret >= 0 && ret <= 4096) { return null; } LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LightningError(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -65,6 +74,7 @@ public class LightningError extends CommonBase { long clone_ptr() { long ret = bindings.LightningError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +83,7 @@ public class LightningError extends CommonBase { */ public LightningError clone() { long ret = bindings.LightningError_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } LightningError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LightningError(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Listen.java b/src/main/java/org/ldk/structs/Listen.java index 8c57278a..93c1fc22 100644 --- a/src/main/java/org/ldk/structs/Listen.java +++ b/src/main/java/org/ldk/structs/Listen.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -57,6 +58,9 @@ public class Listen extends CommonBase { */ public void block_connected(byte[] block, int height) { bindings.Listen_block_connected(this.ptr, block, height); + Reference.reachabilityFence(this); + Reference.reachabilityFence(block); + Reference.reachabilityFence(height); } /** @@ -64,6 +68,9 @@ public class Listen extends CommonBase { */ public void block_disconnected(byte[] header, int height) { bindings.Listen_block_disconnected(this.ptr, InternalUtils.check_arr_len(header, 80), height); + Reference.reachabilityFence(this); + Reference.reachabilityFence(header); + Reference.reachabilityFence(height); } } diff --git a/src/main/java/org/ldk/structs/LockableScore.java b/src/main/java/org/ldk/structs/LockableScore.java index 4cb8fdaee..7716950a 100644 --- a/src/main/java/org/ldk/structs/LockableScore.java +++ b/src/main/java/org/ldk/structs/LockableScore.java @@ -4,9 +4,9 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; - /** * A scorer that is accessed under a lock. * @@ -19,31 +19,47 @@ import javax.annotation.Nullable; */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class LockableScore extends CommonBase { - LockableScore(Object _dummy, long ptr) { super(ptr); } + final bindings.LDKLockableScore bindings_instance; + LockableScore(Object _dummy, long ptr) { super(ptr); bindings_instance = null; } + private LockableScore(bindings.LDKLockableScore arg) { + super(bindings.LDKLockableScore_new(arg)); + this.ptrs_to.add(arg); + this.bindings_instance = arg; + } @Override @SuppressWarnings("deprecation") protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.LockableScore_free(ptr); } + if (ptr != 0) { bindings.LockableScore_free(ptr); } super.finalize(); } + public static interface LockableScoreInterface { + /** + * Returns the locked scorer. + */ + Score lock(); + } + private static class LDKLockableScoreHolder { LockableScore held; } + public static LockableScore new_impl(LockableScoreInterface arg) { + final LDKLockableScoreHolder impl_holder = new LDKLockableScoreHolder(); + impl_holder.held = new LockableScore(new bindings.LDKLockableScore() { + @Override public long lock() { + Score ret = arg.lock(); + long result = ret == null ? 0 : ret.ptr; + impl_holder.held.ptrs_to.add(ret); + return result; + } + }); + return impl_holder.held; + } /** - * Constructs a new LockableScore from a Score + * Returns the locked scorer. */ - public static LockableScore of(Score score) { - long ret = bindings.LockableScore_new(score == null ? 0 : score.ptr); + public Score lock() { + long ret = bindings.LockableScore_lock(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - LockableScore ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new LockableScore(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(score); + Score ret_hu_conv = new Score(null, ret); + ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } - /** - * Serialize the LockableScore object into a byte array which can be read by LockableScore_read - */ - public byte[] write() { - byte[] ret = bindings.LockableScore_write(this.ptr); - return ret; - } - } diff --git a/src/main/java/org/ldk/structs/LockedChannelMonitor.java b/src/main/java/org/ldk/structs/LockedChannelMonitor.java index 9aa5057e..7d752e82 100644 --- a/src/main/java/org/ldk/structs/LockedChannelMonitor.java +++ b/src/main/java/org/ldk/structs/LockedChannelMonitor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; diff --git a/src/main/java/org/ldk/structs/Logger.java b/src/main/java/org/ldk/structs/Logger.java index 8c5660d9..f6da457b 100644 --- a/src/main/java/org/ldk/structs/Logger.java +++ b/src/main/java/org/ldk/structs/Logger.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** diff --git a/src/main/java/org/ldk/structs/MessageHandler.java b/src/main/java/org/ldk/structs/MessageHandler.java index f75435b3..8d20a72e 100644 --- a/src/main/java/org/ldk/structs/MessageHandler.java +++ b/src/main/java/org/ldk/structs/MessageHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class MessageHandler extends CommonBase { */ public ChannelMessageHandler get_chan_handler() { long ret = bindings.MessageHandler_get_chan_handler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelMessageHandler ret_hu_conv = new ChannelMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -41,6 +43,8 @@ public class MessageHandler extends CommonBase { */ public void set_chan_handler(ChannelMessageHandler val) { bindings.MessageHandler_set_chan_handler(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -53,6 +57,7 @@ public class MessageHandler extends CommonBase { */ public RoutingMessageHandler get_route_handler() { long ret = bindings.MessageHandler_get_route_handler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -68,6 +73,8 @@ public class MessageHandler extends CommonBase { */ public void set_route_handler(RoutingMessageHandler val) { bindings.MessageHandler_set_route_handler(this.ptr, val == null ? 0 : val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); this.ptrs_to.add(val); } @@ -76,6 +83,8 @@ public class MessageHandler extends CommonBase { */ public static MessageHandler of(ChannelMessageHandler chan_handler_arg, RoutingMessageHandler route_handler_arg) { long ret = bindings.MessageHandler_new(chan_handler_arg == null ? 0 : chan_handler_arg.ptr, route_handler_arg == null ? 0 : route_handler_arg.ptr); + Reference.reachabilityFence(chan_handler_arg); + Reference.reachabilityFence(route_handler_arg); if (ret >= 0 && ret <= 4096) { return null; } MessageHandler ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MessageHandler(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/MessageSendEvent.java b/src/main/java/org/ldk/structs/MessageSendEvent.java index 83e29cf7..535c80c7 100644 --- a/src/main/java/org/ldk/structs/MessageSendEvent.java +++ b/src/main/java/org/ldk/structs/MessageSendEvent.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -490,6 +491,7 @@ public class MessageSendEvent extends CommonBase { } long clone_ptr() { long ret = bindings.MessageSendEvent_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -498,6 +500,7 @@ public class MessageSendEvent extends CommonBase { */ public MessageSendEvent clone() { long ret = bindings.MessageSendEvent_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -509,6 +512,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_accept_channel(byte[] node_id, AcceptChannel msg) { long ret = bindings.MessageSendEvent_send_accept_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -520,6 +525,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_open_channel(byte[] node_id, OpenChannel msg) { long ret = bindings.MessageSendEvent_send_open_channel(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -531,6 +538,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_funding_created(byte[] node_id, FundingCreated msg) { long ret = bindings.MessageSendEvent_send_funding_created(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -542,6 +551,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_funding_signed(byte[] node_id, FundingSigned msg) { long ret = bindings.MessageSendEvent_send_funding_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -553,6 +564,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_funding_locked(byte[] node_id, FundingLocked msg) { long ret = bindings.MessageSendEvent_send_funding_locked(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -564,6 +577,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_announcement_signatures(byte[] node_id, AnnouncementSignatures msg) { long ret = bindings.MessageSendEvent_send_announcement_signatures(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -575,6 +590,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent update_htlcs(byte[] node_id, CommitmentUpdate updates) { long ret = bindings.MessageSendEvent_update_htlcs(InternalUtils.check_arr_len(node_id, 33), updates == null ? 0 : updates.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(updates); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -586,6 +603,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_revoke_and_ack(byte[] node_id, RevokeAndACK msg) { long ret = bindings.MessageSendEvent_send_revoke_and_ack(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -597,6 +616,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_closing_signed(byte[] node_id, ClosingSigned msg) { long ret = bindings.MessageSendEvent_send_closing_signed(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -608,6 +629,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_shutdown(byte[] node_id, Shutdown msg) { long ret = bindings.MessageSendEvent_send_shutdown(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -619,6 +642,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_channel_reestablish(byte[] node_id, ChannelReestablish msg) { long ret = bindings.MessageSendEvent_send_channel_reestablish(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -630,6 +655,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent broadcast_channel_announcement(ChannelAnnouncement msg, ChannelUpdate update_msg) { long ret = bindings.MessageSendEvent_broadcast_channel_announcement(msg == null ? 0 : msg.ptr & ~1, update_msg == null ? 0 : update_msg.ptr & ~1); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(update_msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -641,6 +668,7 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent broadcast_node_announcement(NodeAnnouncement msg) { long ret = bindings.MessageSendEvent_broadcast_node_announcement(msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -652,6 +680,7 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent broadcast_channel_update(ChannelUpdate msg) { long ret = bindings.MessageSendEvent_broadcast_channel_update(msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -663,6 +692,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_channel_update(byte[] node_id, ChannelUpdate msg) { long ret = bindings.MessageSendEvent_send_channel_update(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -674,6 +705,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent handle_error(byte[] node_id, ErrorAction action) { long ret = bindings.MessageSendEvent_handle_error(InternalUtils.check_arr_len(node_id, 33), action.ptr); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(action); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -685,6 +718,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_channel_range_query(byte[] node_id, QueryChannelRange msg) { long ret = bindings.MessageSendEvent_send_channel_range_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -696,6 +731,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_short_ids_query(byte[] node_id, QueryShortChannelIds msg) { long ret = bindings.MessageSendEvent_send_short_ids_query(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -707,6 +744,8 @@ public class MessageSendEvent extends CommonBase { */ public static MessageSendEvent send_reply_channel_range(byte[] node_id, ReplyChannelRange msg) { long ret = bindings.MessageSendEvent_send_reply_channel_range(InternalUtils.check_arr_len(node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java index 85117b98..ee16a9f2 100644 --- a/src/main/java/org/ldk/structs/MessageSendEventsProvider.java +++ b/src/main/java/org/ldk/structs/MessageSendEventsProvider.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -48,6 +49,7 @@ public class MessageSendEventsProvider extends CommonBase { */ public MessageSendEvent[] get_and_clear_pending_msg_events() { long[] ret = bindings.MessageSendEventsProvider_get_and_clear_pending_msg_events(this.ptr); + Reference.reachabilityFence(this); MessageSendEvent[] ret_conv_18_arr = new MessageSendEvent[ret.length]; for (int s = 0; s < ret.length; s++) { long ret_conv_18 = ret[s]; diff --git a/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java b/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java index 56f6937b..862cb9f1 100644 --- a/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java +++ b/src/main/java/org/ldk/structs/MinFinalCltvExpiry.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,11 +22,14 @@ public class MinFinalCltvExpiry extends CommonBase { public long get_a() { long ret = bindings.MinFinalCltvExpiry_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } public void set_a(long val) { bindings.MinFinalCltvExpiry_set_a(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -33,6 +37,7 @@ public class MinFinalCltvExpiry extends CommonBase { */ public static MinFinalCltvExpiry of(long a_arg) { long ret = bindings.MinFinalCltvExpiry_new(a_arg); + Reference.reachabilityFence(a_arg); if (ret >= 0 && ret <= 4096) { return null; } MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MinFinalCltvExpiry(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -41,6 +46,7 @@ public class MinFinalCltvExpiry extends CommonBase { long clone_ptr() { long ret = bindings.MinFinalCltvExpiry_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +55,7 @@ public class MinFinalCltvExpiry extends CommonBase { */ public MinFinalCltvExpiry clone() { long ret = bindings.MinFinalCltvExpiry_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MinFinalCltvExpiry(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -60,9 +67,13 @@ public class MinFinalCltvExpiry extends CommonBase { */ public long hash() { long ret = bindings.MinFinalCltvExpiry_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two MinFinalCltvExpirys contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -70,8 +81,14 @@ public class MinFinalCltvExpiry extends CommonBase { */ public boolean eq(MinFinalCltvExpiry b) { boolean ret = bindings.MinFinalCltvExpiry_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof MinFinalCltvExpiry)) return false; + return this.eq((MinFinalCltvExpiry)o); + } } diff --git a/src/main/java/org/ldk/structs/MonitorEvent.java b/src/main/java/org/ldk/structs/MonitorEvent.java index 38a63b38..5ba0cc37 100644 --- a/src/main/java/org/ldk/structs/MonitorEvent.java +++ b/src/main/java/org/ldk/structs/MonitorEvent.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -107,6 +108,7 @@ public class MonitorEvent extends CommonBase { } long clone_ptr() { long ret = bindings.MonitorEvent_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -115,6 +117,7 @@ public class MonitorEvent extends CommonBase { */ public MonitorEvent clone() { long ret = bindings.MonitorEvent_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -126,6 +129,7 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent htlcevent(HTLCUpdate a) { long ret = bindings.MonitorEvent_htlcevent(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -137,6 +141,7 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent commitment_tx_confirmed(OutPoint a) { long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -148,6 +153,8 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent update_completed(OutPoint funding_txo, long monitor_update_id) { long ret = bindings.MonitorEvent_update_completed(funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor_update_id); + Reference.reachabilityFence(funding_txo); + Reference.reachabilityFence(monitor_update_id); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -159,6 +166,7 @@ public class MonitorEvent extends CommonBase { */ public static MonitorEvent update_failed(OutPoint a) { long ret = bindings.MonitorEvent_update_failed(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -170,6 +178,7 @@ public class MonitorEvent extends CommonBase { */ public byte[] write() { byte[] ret = bindings.MonitorEvent_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/MonitorUpdateError.java b/src/main/java/org/ldk/structs/MonitorUpdateError.java deleted file mode 100644 index aa425da9..00000000 --- a/src/main/java/org/ldk/structs/MonitorUpdateError.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import javax.annotation.Nullable; - - -/** - * General Err type for ChannelMonitor actions. Generally, this implies that the data provided is - * inconsistent with the ChannelMonitor being called. eg for ChannelMonitor::update_monitor this - * means you tried to update a monitor for a different channel or the ChannelMonitorUpdate was - * corrupted. - * Contains a developer-readable error message. - */ -@SuppressWarnings("unchecked") // We correctly assign various generic arrays -public class MonitorUpdateError extends CommonBase { - MonitorUpdateError(Object _dummy, long ptr) { super(ptr); } - @Override @SuppressWarnings("deprecation") - protected void finalize() throws Throwable { - super.finalize(); - if (ptr != 0) { bindings.MonitorUpdateError_free(ptr); } - } - - public String get_a() { - String ret = bindings.MonitorUpdateError_get_a(this.ptr); - return ret; - } - - public void set_a(java.lang.String val) { - bindings.MonitorUpdateError_set_a(this.ptr, val); - } - - /** - * Constructs a new MonitorUpdateError given each field - */ - public static MonitorUpdateError of(java.lang.String a_arg) { - long ret = bindings.MonitorUpdateError_new(a_arg); - if (ret >= 0 && ret <= 4096) { return null; } - MonitorUpdateError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MonitorUpdateError(null, ret); } - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - long clone_ptr() { - long ret = bindings.MonitorUpdateError_clone_ptr(this.ptr); - return ret; - } - - /** - * Creates a copy of the MonitorUpdateError - */ - public MonitorUpdateError clone() { - long ret = bindings.MonitorUpdateError_clone(this.ptr); - if (ret >= 0 && ret <= 4096) { return null; } - MonitorUpdateError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MonitorUpdateError(null, ret); } - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/MonitorUpdateId.java b/src/main/java/org/ldk/structs/MonitorUpdateId.java index bdc9e7f1..89929f96 100644 --- a/src/main/java/org/ldk/structs/MonitorUpdateId.java +++ b/src/main/java/org/ldk/structs/MonitorUpdateId.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class MonitorUpdateId extends CommonBase { long clone_ptr() { long ret = bindings.MonitorUpdateId_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class MonitorUpdateId extends CommonBase { */ public MonitorUpdateId clone() { long ret = bindings.MonitorUpdateId_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MonitorUpdateId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MonitorUpdateId(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,9 +43,13 @@ public class MonitorUpdateId extends CommonBase { */ public long hash() { long ret = bindings.MonitorUpdateId_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two MonitorUpdateIds contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -50,8 +57,14 @@ public class MonitorUpdateId extends CommonBase { */ public boolean eq(MonitorUpdateId b) { boolean ret = bindings.MonitorUpdateId_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof MonitorUpdateId)) return false; + return this.eq((MonitorUpdateId)o); + } } diff --git a/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java b/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java new file mode 100644 index 00000000..23eafa41 --- /dev/null +++ b/src/main/java/org/ldk/structs/MultiThreadedLockableScore.java @@ -0,0 +1,36 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + + +/** + * A concrete implementation of [`LockableScore`] which supports multi-threading. + */ +@SuppressWarnings("unchecked") // We correctly assign various generic arrays +public class MultiThreadedLockableScore extends CommonBase { + MultiThreadedLockableScore(Object _dummy, long ptr) { super(ptr); } + @Override @SuppressWarnings("deprecation") + protected void finalize() throws Throwable { + super.finalize(); + if (ptr != 0) { bindings.MultiThreadedLockableScore_free(ptr); } + } + + /** + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + */ + public static MultiThreadedLockableScore of(Score score) { + long ret = bindings.MultiThreadedLockableScore_new(score == null ? 0 : score.ptr); + Reference.reachabilityFence(score); + if (ret >= 0 && ret <= 4096) { return null; } + MultiThreadedLockableScore ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MultiThreadedLockableScore(null, ret); } + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(score); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/NetAddress.java b/src/main/java/org/ldk/structs/NetAddress.java index 242e169a..55851a71 100644 --- a/src/main/java/org/ldk/structs/NetAddress.java +++ b/src/main/java/org/ldk/structs/NetAddress.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -73,20 +74,15 @@ public class NetAddress extends CommonBase { } /** * An old-style Tor onion address/port on which the peer is listening. + * + * This field is deprecated and the Tor network generally no longer supports V2 Onion + * addresses. Thus, the details are not parsed here. */ public final static class OnionV2 extends NetAddress { - /** - * The bytes (usually encoded in base32 with \".onion\" appended) - */ - public final byte[] addr; - /** - * The port on which the node is listening - */ - public final short port; + public final byte[] onion_v2; private OnionV2(long ptr, bindings.LDKNetAddress.OnionV2 obj) { super(null, ptr); - this.addr = obj.addr; - this.port = obj.port; + this.onion_v2 = obj.onion_v2; } } /** @@ -121,6 +117,7 @@ public class NetAddress extends CommonBase { } long clone_ptr() { long ret = bindings.NetAddress_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -129,6 +126,7 @@ public class NetAddress extends CommonBase { */ public NetAddress clone() { long ret = bindings.NetAddress_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -140,6 +138,8 @@ public class NetAddress extends CommonBase { */ public static NetAddress ipv4(byte[] addr, short port) { long ret = bindings.NetAddress_ipv4(InternalUtils.check_arr_len(addr, 4), port); + Reference.reachabilityFence(addr); + Reference.reachabilityFence(port); if (ret >= 0 && ret <= 4096) { return null; } NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -151,6 +151,8 @@ public class NetAddress extends CommonBase { */ public static NetAddress ipv6(byte[] addr, short port) { long ret = bindings.NetAddress_ipv6(InternalUtils.check_arr_len(addr, 16), port); + Reference.reachabilityFence(addr); + Reference.reachabilityFence(port); if (ret >= 0 && ret <= 4096) { return null; } NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -160,8 +162,9 @@ public class NetAddress extends CommonBase { /** * Utility method to constructs a new OnionV2-variant NetAddress */ - public static NetAddress onion_v2(byte[] addr, short port) { - long ret = bindings.NetAddress_onion_v2(InternalUtils.check_arr_len(addr, 10), port); + public static NetAddress onion_v2(byte[] a) { + long ret = bindings.NetAddress_onion_v2(InternalUtils.check_arr_len(a, 12)); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -173,6 +176,10 @@ public class NetAddress extends CommonBase { */ public static NetAddress onion_v3(byte[] ed25519_pubkey, short checksum, byte version, short port) { long ret = bindings.NetAddress_onion_v3(InternalUtils.check_arr_len(ed25519_pubkey, 32), checksum, version, port); + Reference.reachabilityFence(ed25519_pubkey); + Reference.reachabilityFence(checksum); + Reference.reachabilityFence(version); + Reference.reachabilityFence(port); if (ret >= 0 && ret <= 4096) { return null; } NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -184,6 +191,7 @@ public class NetAddress extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NetAddress_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -192,6 +200,7 @@ public class NetAddress extends CommonBase { */ public static Result_NetAddressDecodeErrorZ read(byte[] ser) { long ret = bindings.NetAddress_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NetAddressDecodeErrorZ ret_hu_conv = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/NetGraphMsgHandler.java b/src/main/java/org/ldk/structs/NetGraphMsgHandler.java index 4331c73f..2236f5bc 100644 --- a/src/main/java/org/ldk/structs/NetGraphMsgHandler.java +++ b/src/main/java/org/ldk/structs/NetGraphMsgHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -32,6 +33,7 @@ public class NetGraphMsgHandler extends CommonBase { */ public EventHandler as_EventHandler() { long ret = bindings.NetGraphMsgHandler_as_EventHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } EventHandler ret_hu_conv = new EventHandler(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -47,6 +49,9 @@ public class NetGraphMsgHandler extends CommonBase { */ public static NetGraphMsgHandler of(NetworkGraph network_graph, Option_AccessZ chain_access, Logger logger) { long ret = bindings.NetGraphMsgHandler_new(network_graph == null ? 0 : network_graph.ptr & ~1, chain_access.ptr, logger == null ? 0 : logger.ptr); + Reference.reachabilityFence(network_graph); + Reference.reachabilityFence(chain_access); + Reference.reachabilityFence(logger); if (ret >= 0 && ret <= 4096) { return null; } NetGraphMsgHandler ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NetGraphMsgHandler(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -63,6 +68,8 @@ public class NetGraphMsgHandler extends CommonBase { */ public void add_chain_access(Option_AccessZ chain_access) { bindings.NetGraphMsgHandler_add_chain_access(this.ptr, chain_access.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(chain_access); this.ptrs_to.add(chain_access); } @@ -72,6 +79,7 @@ public class NetGraphMsgHandler extends CommonBase { */ public RoutingMessageHandler as_RoutingMessageHandler() { long ret = bindings.NetGraphMsgHandler_as_RoutingMessageHandler(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -84,6 +92,7 @@ public class NetGraphMsgHandler extends CommonBase { */ public MessageSendEventsProvider as_MessageSendEventsProvider() { long ret = bindings.NetGraphMsgHandler_as_MessageSendEventsProvider(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/NetworkGraph.java b/src/main/java/org/ldk/structs/NetworkGraph.java index 1c2469d4..e2f17ce1 100644 --- a/src/main/java/org/ldk/structs/NetworkGraph.java +++ b/src/main/java/org/ldk/structs/NetworkGraph.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class NetworkGraph extends CommonBase { long clone_ptr() { long ret = bindings.NetworkGraph_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class NetworkGraph extends CommonBase { */ public NetworkGraph clone() { long ret = bindings.NetworkGraph_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NetworkGraph ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NetworkGraph(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,6 +43,7 @@ public class NetworkGraph extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NetworkGraph_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -48,6 +52,7 @@ public class NetworkGraph extends CommonBase { */ public static Result_NetworkGraphDecodeErrorZ read(byte[] ser) { long ret = bindings.NetworkGraph_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,6 +63,7 @@ public class NetworkGraph extends CommonBase { */ public static NetworkGraph of(byte[] genesis_hash) { long ret = bindings.NetworkGraph_new(InternalUtils.check_arr_len(genesis_hash, 32)); + Reference.reachabilityFence(genesis_hash); if (ret >= 0 && ret <= 4096) { return null; } NetworkGraph ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NetworkGraph(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -69,6 +75,7 @@ public class NetworkGraph extends CommonBase { */ public ReadOnlyNetworkGraph read_only() { long ret = bindings.NetworkGraph_read_only(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ReadOnlyNetworkGraph ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReadOnlyNetworkGraph(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -85,6 +92,8 @@ public class NetworkGraph extends CommonBase { */ public Result_NoneLightningErrorZ update_node_from_announcement(NodeAnnouncement msg) { long ret = bindings.NetworkGraph_update_node_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -99,6 +108,8 @@ public class NetworkGraph extends CommonBase { */ public Result_NoneLightningErrorZ update_node_from_unsigned_announcement(UnsignedNodeAnnouncement msg) { long ret = bindings.NetworkGraph_update_node_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -117,6 +128,9 @@ public class NetworkGraph extends CommonBase { */ public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Option_AccessZ chain_access) { long ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(chain_access); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -134,6 +148,9 @@ public class NetworkGraph extends CommonBase { */ public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Option_AccessZ chain_access) { long ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(chain_access); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -149,6 +166,9 @@ public class NetworkGraph extends CommonBase { */ public void close_channel_from_update(long short_channel_id, boolean is_permanent) { bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent); + Reference.reachabilityFence(this); + Reference.reachabilityFence(short_channel_id); + Reference.reachabilityFence(is_permanent); } /** @@ -156,6 +176,27 @@ public class NetworkGraph extends CommonBase { */ public void fail_node(byte[] _node_id, boolean is_permanent) { bindings.NetworkGraph_fail_node(this.ptr, InternalUtils.check_arr_len(_node_id, 33), is_permanent); + Reference.reachabilityFence(this); + Reference.reachabilityFence(_node_id); + Reference.reachabilityFence(is_permanent); + } + + /** + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. + * + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. + * + * This function takes the current unix time as an argument. For users with the `std` feature + * enabled, [`NetworkGraph::remove_stale_channels`] may be preferable. + */ + public void remove_stale_channels_with_time(long current_time_unix) { + bindings.NetworkGraph_remove_stale_channels_with_time(this.ptr, current_time_unix); + Reference.reachabilityFence(this); + Reference.reachabilityFence(current_time_unix); } /** @@ -165,9 +206,14 @@ public class NetworkGraph extends CommonBase { * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) { long ret = bindings.NetworkGraph_update_channel(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -178,9 +224,14 @@ public class NetworkGraph extends CommonBase { * For an already known (from announcement) channel, update info about one of the directions * of the channel without verifying the associated signatures. Because we aren't given the * associated signatures here we cannot relay the channel update to any of our peers. + * + * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ public Result_NoneLightningErrorZ update_channel_unsigned(UnsignedChannelUpdate msg) { long ret = bindings.NetworkGraph_update_channel_unsigned(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); diff --git a/src/main/java/org/ldk/structs/NetworkUpdate.java b/src/main/java/org/ldk/structs/NetworkUpdate.java index 8abc8b58..a8638f3c 100644 --- a/src/main/java/org/ldk/structs/NetworkUpdate.java +++ b/src/main/java/org/ldk/structs/NetworkUpdate.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -94,6 +95,7 @@ public class NetworkUpdate extends CommonBase { } long clone_ptr() { long ret = bindings.NetworkUpdate_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -102,6 +104,7 @@ public class NetworkUpdate extends CommonBase { */ public NetworkUpdate clone() { long ret = bindings.NetworkUpdate_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -113,6 +116,7 @@ public class NetworkUpdate extends CommonBase { */ public static NetworkUpdate channel_update_message(ChannelUpdate msg) { long ret = bindings.NetworkUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -124,6 +128,8 @@ public class NetworkUpdate extends CommonBase { */ public static NetworkUpdate channel_closed(long short_channel_id, boolean is_permanent) { long ret = bindings.NetworkUpdate_channel_closed(short_channel_id, is_permanent); + Reference.reachabilityFence(short_channel_id); + Reference.reachabilityFence(is_permanent); if (ret >= 0 && ret <= 4096) { return null; } NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -135,6 +141,8 @@ public class NetworkUpdate extends CommonBase { */ public static NetworkUpdate node_failure(byte[] node_id, boolean is_permanent) { long ret = bindings.NetworkUpdate_node_failure(InternalUtils.check_arr_len(node_id, 33), is_permanent); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(is_permanent); if (ret >= 0 && ret <= 4096) { return null; } NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -146,6 +154,7 @@ public class NetworkUpdate extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NetworkUpdate_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/NodeAnnouncement.java b/src/main/java/org/ldk/structs/NodeAnnouncement.java index da8ce46b..7168cde2 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncement.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class NodeAnnouncement extends CommonBase { */ public byte[] get_signature() { byte[] ret = bindings.NodeAnnouncement_get_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class NodeAnnouncement extends CommonBase { */ public void set_signature(byte[] val) { bindings.NodeAnnouncement_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class NodeAnnouncement extends CommonBase { */ public UnsignedNodeAnnouncement get_contents() { long ret = bindings.NodeAnnouncement_get_contents(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedNodeAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -50,6 +55,8 @@ public class NodeAnnouncement extends CommonBase { */ public void set_contents(UnsignedNodeAnnouncement val) { bindings.NodeAnnouncement_set_contents(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,8 @@ public class NodeAnnouncement extends CommonBase { */ public static NodeAnnouncement of(byte[] signature_arg, UnsignedNodeAnnouncement contents_arg) { long ret = bindings.NodeAnnouncement_new(InternalUtils.check_arr_len(signature_arg, 64), contents_arg == null ? 0 : contents_arg.ptr & ~1); + Reference.reachabilityFence(signature_arg); + Reference.reachabilityFence(contents_arg); if (ret >= 0 && ret <= 4096) { return null; } NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -65,6 +74,7 @@ public class NodeAnnouncement extends CommonBase { long clone_ptr() { long ret = bindings.NodeAnnouncement_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +83,7 @@ public class NodeAnnouncement extends CommonBase { */ public NodeAnnouncement clone() { long ret = bindings.NodeAnnouncement_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -84,6 +95,7 @@ public class NodeAnnouncement extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NodeAnnouncement_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +104,7 @@ public class NodeAnnouncement extends CommonBase { */ public static Result_NodeAnnouncementDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeAnnouncement_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java index 7b029328..765463f9 100644 --- a/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java +++ b/src/main/java/org/ldk/structs/NodeAnnouncementInfo.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public NodeFeatures get_features() { long ret = bindings.NodeAnnouncementInfo_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,8 @@ public class NodeAnnouncementInfo extends CommonBase { */ public void set_features(NodeFeatures val) { bindings.NodeAnnouncementInfo_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public int get_last_update() { int ret = bindings.NodeAnnouncementInfo_get_last_update(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -52,6 +57,8 @@ public class NodeAnnouncementInfo extends CommonBase { */ public void set_last_update(int val) { bindings.NodeAnnouncementInfo_set_last_update(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -59,6 +66,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public byte[] get_rgb() { byte[] ret = bindings.NodeAnnouncementInfo_get_rgb(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -67,6 +75,8 @@ public class NodeAnnouncementInfo extends CommonBase { */ public void set_rgb(byte[] val) { bindings.NodeAnnouncementInfo_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -76,6 +86,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public byte[] get_alias() { byte[] ret = bindings.NodeAnnouncementInfo_get_alias(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -86,6 +97,8 @@ public class NodeAnnouncementInfo extends CommonBase { */ public void set_alias(byte[] val) { bindings.NodeAnnouncementInfo_set_alias(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -93,6 +106,8 @@ public class NodeAnnouncementInfo extends CommonBase { */ public void set_addresses(NetAddress[] val) { bindings.NodeAnnouncementInfo_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -106,6 +121,7 @@ public class NodeAnnouncementInfo extends CommonBase { @Nullable public NodeAnnouncement get_announcement_message() { long ret = bindings.NodeAnnouncementInfo_get_announcement_message(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -122,6 +138,8 @@ public class NodeAnnouncementInfo extends CommonBase { */ public void set_announcement_message(@Nullable NodeAnnouncement val) { bindings.NodeAnnouncementInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -129,6 +147,12 @@ public class NodeAnnouncementInfo extends CommonBase { */ public static NodeAnnouncementInfo of(NodeFeatures features_arg, int last_update_arg, byte[] rgb_arg, byte[] alias_arg, NetAddress[] addresses_arg, NodeAnnouncement announcement_message_arg) { long ret = bindings.NodeAnnouncementInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, last_update_arg, InternalUtils.check_arr_len(rgb_arg, 3), InternalUtils.check_arr_len(alias_arg, 32), addresses_arg != null ? Arrays.stream(addresses_arg).mapToLong(addresses_arg_conv_12 -> addresses_arg_conv_12.ptr).toArray() : null, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); + Reference.reachabilityFence(features_arg); + Reference.reachabilityFence(last_update_arg); + Reference.reachabilityFence(rgb_arg); + Reference.reachabilityFence(alias_arg); + Reference.reachabilityFence(addresses_arg); + Reference.reachabilityFence(announcement_message_arg); if (ret >= 0 && ret <= 4096) { return null; } NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncementInfo(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -137,6 +161,7 @@ public class NodeAnnouncementInfo extends CommonBase { long clone_ptr() { long ret = bindings.NodeAnnouncementInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -145,6 +170,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public NodeAnnouncementInfo clone() { long ret = bindings.NodeAnnouncementInfo_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncementInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -156,6 +182,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NodeAnnouncementInfo_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -164,6 +191,7 @@ public class NodeAnnouncementInfo extends CommonBase { */ public static Result_NodeAnnouncementInfoDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeAnnouncementInfo_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/NodeFeatures.java b/src/main/java/org/ldk/structs/NodeFeatures.java index 1a05b6d5..6eeba7fb 100644 --- a/src/main/java/org/ldk/structs/NodeFeatures.java +++ b/src/main/java/org/ldk/structs/NodeFeatures.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,12 +27,19 @@ public class NodeFeatures extends CommonBase { */ public boolean eq(NodeFeatures b) { boolean ret = bindings.NodeFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof NodeFeatures)) return false; + return this.eq((NodeFeatures)o); + } long clone_ptr() { long ret = bindings.NodeFeatures_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -40,6 +48,7 @@ public class NodeFeatures extends CommonBase { */ public NodeFeatures clone() { long ret = bindings.NodeFeatures_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -74,14 +83,7 @@ public class NodeFeatures extends CommonBase { */ public boolean requires_unknown_bits() { boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr); - return ret; - } - - /** - * Returns whether the `payment_secret` feature is supported. - */ - public boolean supports_payment_secret() { - boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -90,6 +92,7 @@ public class NodeFeatures extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NodeFeatures_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -98,6 +101,7 @@ public class NodeFeatures extends CommonBase { */ public static Result_NodeFeaturesDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeFeatures_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/NodeId.java b/src/main/java/org/ldk/structs/NodeId.java index a0074a65..354a619f 100644 --- a/src/main/java/org/ldk/structs/NodeId.java +++ b/src/main/java/org/ldk/structs/NodeId.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class NodeId extends CommonBase { long clone_ptr() { long ret = bindings.NodeId_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class NodeId extends CommonBase { */ public NodeId clone() { long ret = bindings.NodeId_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,6 +43,7 @@ public class NodeId extends CommonBase { */ public static NodeId from_pubkey(byte[] pubkey) { long ret = bindings.NodeId_from_pubkey(InternalUtils.check_arr_len(pubkey, 33)); + Reference.reachabilityFence(pubkey); if (ret >= 0 && ret <= 4096) { return null; } NodeId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeId(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -51,6 +55,7 @@ public class NodeId extends CommonBase { */ public byte[] as_slice() { byte[] ret = bindings.NodeId_as_slice(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -59,14 +64,19 @@ public class NodeId extends CommonBase { */ public long hash() { long ret = bindings.NodeId_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Serialize the NodeId object into a byte array which can be read by NodeId_read */ public byte[] write() { byte[] ret = bindings.NodeId_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +85,7 @@ public class NodeId extends CommonBase { */ public static Result_NodeIdDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeId_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/NodeInfo.java b/src/main/java/org/ldk/structs/NodeInfo.java index e091c6c6..803f8e69 100644 --- a/src/main/java/org/ldk/structs/NodeInfo.java +++ b/src/main/java/org/ldk/structs/NodeInfo.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,8 @@ public class NodeInfo extends CommonBase { */ public void set_channels(long[] val) { bindings.NodeInfo_set_channels(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -36,6 +39,7 @@ public class NodeInfo extends CommonBase { @Nullable public RoutingFees get_lowest_inbound_channel_fees() { long ret = bindings.NodeInfo_get_lowest_inbound_channel_fees(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -51,6 +55,8 @@ public class NodeInfo extends CommonBase { */ public void set_lowest_inbound_channel_fees(@Nullable RoutingFees val) { bindings.NodeInfo_set_lowest_inbound_channel_fees(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -63,6 +69,7 @@ public class NodeInfo extends CommonBase { @Nullable public NodeAnnouncementInfo get_announcement_info() { long ret = bindings.NodeInfo_get_announcement_info(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeAnnouncementInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeAnnouncementInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -78,6 +85,8 @@ public class NodeInfo extends CommonBase { */ public void set_announcement_info(@Nullable NodeAnnouncementInfo val) { bindings.NodeInfo_set_announcement_info(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -85,6 +94,9 @@ public class NodeInfo extends CommonBase { */ public static NodeInfo of(long[] channels_arg, RoutingFees lowest_inbound_channel_fees_arg, NodeAnnouncementInfo announcement_info_arg) { long ret = bindings.NodeInfo_new(channels_arg, lowest_inbound_channel_fees_arg == null ? 0 : lowest_inbound_channel_fees_arg.ptr & ~1, announcement_info_arg == null ? 0 : announcement_info_arg.ptr & ~1); + Reference.reachabilityFence(channels_arg); + Reference.reachabilityFence(lowest_inbound_channel_fees_arg); + Reference.reachabilityFence(announcement_info_arg); if (ret >= 0 && ret <= 4096) { return null; } NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeInfo(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -93,6 +105,7 @@ public class NodeInfo extends CommonBase { long clone_ptr() { long ret = bindings.NodeInfo_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -101,6 +114,7 @@ public class NodeInfo extends CommonBase { */ public NodeInfo clone() { long ret = bindings.NodeInfo_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeInfo ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeInfo(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -112,6 +126,7 @@ public class NodeInfo extends CommonBase { */ public byte[] write() { byte[] ret = bindings.NodeInfo_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -120,6 +135,7 @@ public class NodeInfo extends CommonBase { */ public static Result_NodeInfoDecodeErrorZ read(byte[] ser) { long ret = bindings.NodeInfo_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/OpenChannel.java b/src/main/java/org/ldk/structs/OpenChannel.java index 46dee55c..5d4e8870 100644 --- a/src/main/java/org/ldk/structs/OpenChannel.java +++ b/src/main/java/org/ldk/structs/OpenChannel.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.OpenChannel_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class OpenChannel extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.OpenChannel_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_temporary_channel_id() { byte[] ret = bindings.OpenChannel_get_temporary_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class OpenChannel extends CommonBase { */ public void set_temporary_channel_id(byte[] val) { bindings.OpenChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class OpenChannel extends CommonBase { */ public long get_funding_satoshis() { long ret = bindings.OpenChannel_get_funding_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class OpenChannel extends CommonBase { */ public void set_funding_satoshis(long val) { bindings.OpenChannel_set_funding_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class OpenChannel extends CommonBase { */ public long get_push_msat() { long ret = bindings.OpenChannel_get_push_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class OpenChannel extends CommonBase { */ public void set_push_msat(long val) { bindings.OpenChannel_set_push_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +97,7 @@ public class OpenChannel extends CommonBase { */ public long get_dust_limit_satoshis() { long ret = bindings.OpenChannel_get_dust_limit_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +106,8 @@ public class OpenChannel extends CommonBase { */ public void set_dust_limit_satoshis(long val) { bindings.OpenChannel_set_dust_limit_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -99,6 +115,7 @@ public class OpenChannel extends CommonBase { */ public long get_max_htlc_value_in_flight_msat() { long ret = bindings.OpenChannel_get_max_htlc_value_in_flight_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -107,6 +124,8 @@ public class OpenChannel extends CommonBase { */ public void set_max_htlc_value_in_flight_msat(long val) { bindings.OpenChannel_set_max_htlc_value_in_flight_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -114,6 +133,7 @@ public class OpenChannel extends CommonBase { */ public long get_channel_reserve_satoshis() { long ret = bindings.OpenChannel_get_channel_reserve_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -122,6 +142,8 @@ public class OpenChannel extends CommonBase { */ public void set_channel_reserve_satoshis(long val) { bindings.OpenChannel_set_channel_reserve_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -129,6 +151,7 @@ public class OpenChannel extends CommonBase { */ public long get_htlc_minimum_msat() { long ret = bindings.OpenChannel_get_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -137,6 +160,8 @@ public class OpenChannel extends CommonBase { */ public void set_htlc_minimum_msat(long val) { bindings.OpenChannel_set_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -144,6 +169,7 @@ public class OpenChannel extends CommonBase { */ public int get_feerate_per_kw() { int ret = bindings.OpenChannel_get_feerate_per_kw(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -152,6 +178,8 @@ public class OpenChannel extends CommonBase { */ public void set_feerate_per_kw(int val) { bindings.OpenChannel_set_feerate_per_kw(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -159,6 +187,7 @@ public class OpenChannel extends CommonBase { */ public short get_to_self_delay() { short ret = bindings.OpenChannel_get_to_self_delay(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -167,6 +196,8 @@ public class OpenChannel extends CommonBase { */ public void set_to_self_delay(short val) { bindings.OpenChannel_set_to_self_delay(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -174,6 +205,7 @@ public class OpenChannel extends CommonBase { */ public short get_max_accepted_htlcs() { short ret = bindings.OpenChannel_get_max_accepted_htlcs(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -182,6 +214,8 @@ public class OpenChannel extends CommonBase { */ public void set_max_accepted_htlcs(short val) { bindings.OpenChannel_set_max_accepted_htlcs(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -189,6 +223,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_funding_pubkey() { byte[] ret = bindings.OpenChannel_get_funding_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -197,6 +232,8 @@ public class OpenChannel extends CommonBase { */ public void set_funding_pubkey(byte[] val) { bindings.OpenChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -204,6 +241,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_revocation_basepoint() { byte[] ret = bindings.OpenChannel_get_revocation_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -212,6 +250,8 @@ public class OpenChannel extends CommonBase { */ public void set_revocation_basepoint(byte[] val) { bindings.OpenChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -219,6 +259,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_payment_point() { byte[] ret = bindings.OpenChannel_get_payment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -227,6 +268,8 @@ public class OpenChannel extends CommonBase { */ public void set_payment_point(byte[] val) { bindings.OpenChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -234,6 +277,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_delayed_payment_basepoint() { byte[] ret = bindings.OpenChannel_get_delayed_payment_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -242,6 +286,8 @@ public class OpenChannel extends CommonBase { */ public void set_delayed_payment_basepoint(byte[] val) { bindings.OpenChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -249,6 +295,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_htlc_basepoint() { byte[] ret = bindings.OpenChannel_get_htlc_basepoint(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -257,6 +304,8 @@ public class OpenChannel extends CommonBase { */ public void set_htlc_basepoint(byte[] val) { bindings.OpenChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -264,6 +313,7 @@ public class OpenChannel extends CommonBase { */ public byte[] get_first_per_commitment_point() { byte[] ret = bindings.OpenChannel_get_first_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -272,6 +322,8 @@ public class OpenChannel extends CommonBase { */ public void set_first_per_commitment_point(byte[] val) { bindings.OpenChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -279,6 +331,7 @@ public class OpenChannel extends CommonBase { */ public byte get_channel_flags() { byte ret = bindings.OpenChannel_get_channel_flags(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -287,10 +340,43 @@ public class OpenChannel extends CommonBase { */ public void set_channel_flags(byte val) { bindings.OpenChannel_set_channel_flags(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * The channel type that this channel will represent. If none is set, we derive the channel + * type from the intersection of our feature bits with our counterparty's feature bits from + * the Init message. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public ChannelTypeFeatures get_channel_type() { + long ret = bindings.OpenChannel_get_channel_type(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + ChannelTypeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelTypeFeatures(null, ret); } + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * The channel type that this channel will represent. If none is set, we derive the channel + * type from the intersection of our feature bits with our counterparty's feature bits from + * the Init message. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_channel_type(@Nullable ChannelTypeFeatures val) { + bindings.OpenChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.OpenChannel_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -299,6 +385,7 @@ public class OpenChannel extends CommonBase { */ public OpenChannel clone() { long ret = bindings.OpenChannel_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OpenChannel ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OpenChannel(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -310,6 +397,7 @@ public class OpenChannel extends CommonBase { */ public byte[] write() { byte[] ret = bindings.OpenChannel_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -318,6 +406,7 @@ public class OpenChannel extends CommonBase { */ public static Result_OpenChannelDecodeErrorZ read(byte[] ser) { long ret = bindings.OpenChannel_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Option_AccessZ.java b/src/main/java/org/ldk/structs/Option_AccessZ.java index cb7b1325..78ea0c38 100644 --- a/src/main/java/org/ldk/structs/Option_AccessZ.java +++ b/src/main/java/org/ldk/structs/Option_AccessZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_AccessZ extends CommonBase { */ public static Option_AccessZ some(Access o) { long ret = bindings.COption_AccessZ_some(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java b/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java index 429e51c2..bb51e9d8 100644 --- a/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java +++ b/src/main/java/org/ldk/structs/Option_C2Tuple_usizeTransactionZZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { */ public static Option_C2Tuple_usizeTransactionZZ some(TwoTuple_usizeTransactionZ o) { long ret = bindings.COption_C2Tuple_usizeTransactionZZ_some(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -74,6 +76,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_C2Tuple_usizeTransactionZZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +86,7 @@ public class Option_C2Tuple_usizeTransactionZZ extends CommonBase { */ public Option_C2Tuple_usizeTransactionZZ clone() { long ret = bindings.COption_C2Tuple_usizeTransactionZZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java index a3e77a30..15a5fe32 100644 --- a/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java +++ b/src/main/java/org/ldk/structs/Option_CVec_NetAddressZZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -60,6 +61,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { */ public static Option_CVec_NetAddressZZ some(NetAddress[] o) { long ret = bindings.COption_CVec_NetAddressZZ_some(o != null ? Arrays.stream(o).mapToLong(o_conv_12 -> o_conv_12.ptr).toArray() : null); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -79,6 +81,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_CVec_NetAddressZZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -88,6 +91,7 @@ public class Option_CVec_NetAddressZZ extends CommonBase { */ public Option_CVec_NetAddressZZ clone() { long ret = bindings.COption_CVec_NetAddressZZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java b/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java index 6db3b380..c7f3d09d 100644 --- a/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java +++ b/src/main/java/org/ldk/structs/Option_ClosureReasonZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_ClosureReasonZ extends CommonBase { */ public static Option_ClosureReasonZ some(ClosureReason o) { long ret = bindings.COption_ClosureReasonZ_some(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -74,6 +76,7 @@ public class Option_ClosureReasonZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_ClosureReasonZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +86,7 @@ public class Option_ClosureReasonZ extends CommonBase { */ public Option_ClosureReasonZ clone() { long ret = bindings.COption_ClosureReasonZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_ClosureReasonZ ret_hu_conv = Option_ClosureReasonZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_EventZ.java b/src/main/java/org/ldk/structs/Option_EventZ.java index aa22da99..079431a4 100644 --- a/src/main/java/org/ldk/structs/Option_EventZ.java +++ b/src/main/java/org/ldk/structs/Option_EventZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_EventZ extends CommonBase { */ public static Option_EventZ some(Event o) { long ret = bindings.COption_EventZ_some(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_EventZ ret_hu_conv = Option_EventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -74,6 +76,7 @@ public class Option_EventZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_EventZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +86,7 @@ public class Option_EventZ extends CommonBase { */ public Option_EventZ clone() { long ret = bindings.COption_EventZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_EventZ ret_hu_conv = Option_EventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_FilterZ.java b/src/main/java/org/ldk/structs/Option_FilterZ.java index 0561ae71..d94c6de2 100644 --- a/src/main/java/org/ldk/structs/Option_FilterZ.java +++ b/src/main/java/org/ldk/structs/Option_FilterZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_FilterZ extends CommonBase { */ public static Option_FilterZ some(Filter o) { long ret = bindings.COption_FilterZ_some(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/Option_MonitorEventZ.java b/src/main/java/org/ldk/structs/Option_MonitorEventZ.java index 032e1f39..ab23d228 100644 --- a/src/main/java/org/ldk/structs/Option_MonitorEventZ.java +++ b/src/main/java/org/ldk/structs/Option_MonitorEventZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_MonitorEventZ extends CommonBase { */ public static Option_MonitorEventZ some(MonitorEvent o) { long ret = bindings.COption_MonitorEventZ_some(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -74,6 +76,7 @@ public class Option_MonitorEventZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_MonitorEventZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +86,7 @@ public class Option_MonitorEventZ extends CommonBase { */ public Option_MonitorEventZ clone() { long ret = bindings.COption_MonitorEventZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_MonitorEventZ ret_hu_conv = Option_MonitorEventZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java b/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java index dbd7fcbf..2c2137ad 100644 --- a/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java +++ b/src/main/java/org/ldk/structs/Option_NetworkUpdateZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_NetworkUpdateZ extends CommonBase { */ public static Option_NetworkUpdateZ some(NetworkUpdate o) { long ret = bindings.COption_NetworkUpdateZ_some(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -74,6 +76,7 @@ public class Option_NetworkUpdateZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_NetworkUpdateZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +86,7 @@ public class Option_NetworkUpdateZ extends CommonBase { */ public Option_NetworkUpdateZ clone() { long ret = bindings.COption_NetworkUpdateZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_TypeZ.java b/src/main/java/org/ldk/structs/Option_TypeZ.java index e528bdcb..2a777b0a 100644 --- a/src/main/java/org/ldk/structs/Option_TypeZ.java +++ b/src/main/java/org/ldk/structs/Option_TypeZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -55,6 +56,7 @@ public class Option_TypeZ extends CommonBase { */ public static Option_TypeZ some(Type o) { long ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -75,6 +77,7 @@ public class Option_TypeZ extends CommonBase { long clone_ptr() { long ret = bindings.COption_TypeZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -84,6 +87,7 @@ public class Option_TypeZ extends CommonBase { */ public Option_TypeZ clone() { long ret = bindings.COption_TypeZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_u16Z.java b/src/main/java/org/ldk/structs/Option_u16Z.java index 824247da..238d0c39 100644 --- a/src/main/java/org/ldk/structs/Option_u16Z.java +++ b/src/main/java/org/ldk/structs/Option_u16Z.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -52,6 +53,7 @@ public class Option_u16Z extends CommonBase { */ public static Option_u16Z some(short o) { long ret = bindings.COption_u16Z_some(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -71,6 +73,7 @@ public class Option_u16Z extends CommonBase { long clone_ptr() { long ret = bindings.COption_u16Z_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +83,7 @@ public class Option_u16Z extends CommonBase { */ public Option_u16Z clone() { long ret = bindings.COption_u16Z_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u16Z ret_hu_conv = Option_u16Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_u32Z.java b/src/main/java/org/ldk/structs/Option_u32Z.java index 6a18abfb..a54048ed 100644 --- a/src/main/java/org/ldk/structs/Option_u32Z.java +++ b/src/main/java/org/ldk/structs/Option_u32Z.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -52,6 +53,7 @@ public class Option_u32Z extends CommonBase { */ public static Option_u32Z some(int o) { long ret = bindings.COption_u32Z_some(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -71,6 +73,7 @@ public class Option_u32Z extends CommonBase { long clone_ptr() { long ret = bindings.COption_u32Z_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +83,7 @@ public class Option_u32Z extends CommonBase { */ public Option_u32Z clone() { long ret = bindings.COption_u32Z_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Option_u64Z.java b/src/main/java/org/ldk/structs/Option_u64Z.java index d4c900ba..b344a6b1 100644 --- a/src/main/java/org/ldk/structs/Option_u64Z.java +++ b/src/main/java/org/ldk/structs/Option_u64Z.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -52,6 +53,7 @@ public class Option_u64Z extends CommonBase { */ public static Option_u64Z some(long o) { long ret = bindings.COption_u64Z_some(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -71,6 +73,7 @@ public class Option_u64Z extends CommonBase { long clone_ptr() { long ret = bindings.COption_u64Z_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +83,7 @@ public class Option_u64Z extends CommonBase { */ public Option_u64Z clone() { long ret = bindings.COption_u64Z_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/OutPoint.java b/src/main/java/org/ldk/structs/OutPoint.java index a181f35f..5d6390e7 100644 --- a/src/main/java/org/ldk/structs/OutPoint.java +++ b/src/main/java/org/ldk/structs/OutPoint.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class OutPoint extends CommonBase { */ public byte[] get_txid() { byte[] ret = bindings.OutPoint_get_txid(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -35,6 +37,8 @@ public class OutPoint extends CommonBase { */ public void set_txid(byte[] val) { bindings.OutPoint_set_txid(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class OutPoint extends CommonBase { */ public short get_index() { short ret = bindings.OutPoint_get_index(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class OutPoint extends CommonBase { */ public void set_index(short val) { bindings.OutPoint_set_index(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,8 @@ public class OutPoint extends CommonBase { */ public static OutPoint of(byte[] txid_arg, short index_arg) { long ret = bindings.OutPoint_new(InternalUtils.check_arr_len(txid_arg, 32), index_arg); + Reference.reachabilityFence(txid_arg); + Reference.reachabilityFence(index_arg); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -65,6 +74,7 @@ public class OutPoint extends CommonBase { long clone_ptr() { long ret = bindings.OutPoint_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +83,7 @@ public class OutPoint extends CommonBase { */ public OutPoint clone() { long ret = bindings.OutPoint_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -86,23 +97,34 @@ public class OutPoint extends CommonBase { */ public boolean eq(OutPoint b) { boolean ret = bindings.OutPoint_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof OutPoint)) return false; + return this.eq((OutPoint)o); + } /** * Checks if two OutPoints contain equal inner contents. */ public long hash() { long ret = bindings.OutPoint_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Convert an `OutPoint` to a lightning channel id. */ public byte[] to_channel_id() { byte[] ret = bindings.OutPoint_to_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -111,6 +133,7 @@ public class OutPoint extends CommonBase { */ public byte[] write() { byte[] ret = bindings.OutPoint_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -119,6 +142,7 @@ public class OutPoint extends CommonBase { */ public static Result_OutPointDecodeErrorZ read(byte[] ser) { long ret = bindings.OutPoint_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Payee.java b/src/main/java/org/ldk/structs/Payee.java index 317801b6..610c898c 100644 --- a/src/main/java/org/ldk/structs/Payee.java +++ b/src/main/java/org/ldk/structs/Payee.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class Payee extends CommonBase { */ public byte[] get_pubkey() { byte[] ret = bindings.Payee_get_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class Payee extends CommonBase { */ public void set_pubkey(byte[] val) { bindings.Payee_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -47,6 +51,7 @@ public class Payee extends CommonBase { @Nullable public InvoiceFeatures get_features() { long ret = bindings.Payee_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -65,6 +70,8 @@ public class Payee extends CommonBase { */ public void set_features(@Nullable InvoiceFeatures val) { bindings.Payee_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +79,7 @@ public class Payee extends CommonBase { */ public RouteHint[] get_route_hints() { long[] ret = bindings.Payee_get_route_hints(this.ptr); + Reference.reachabilityFence(this); RouteHint[] ret_conv_11_arr = new RouteHint[ret.length]; for (int l = 0; l < ret.length; l++) { long ret_conv_11 = ret[l]; @@ -87,6 +95,8 @@ public class Payee extends CommonBase { */ public void set_route_hints(RouteHint[] val) { bindings.Payee_set_route_hints(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_11 -> val_conv_11 == null ? 0 : val_conv_11.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -94,6 +104,7 @@ public class Payee extends CommonBase { */ public Option_u64Z get_expiry_time() { long ret = bindings.Payee_get_expiry_time(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -105,6 +116,8 @@ public class Payee extends CommonBase { */ public void set_expiry_time(Option_u64Z val) { bindings.Payee_set_expiry_time(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -112,6 +125,10 @@ public class Payee extends CommonBase { */ public static Payee of(byte[] pubkey_arg, InvoiceFeatures features_arg, RouteHint[] route_hints_arg, Option_u64Z expiry_time_arg) { long ret = bindings.Payee_new(InternalUtils.check_arr_len(pubkey_arg, 33), features_arg == null ? 0 : features_arg.ptr & ~1, route_hints_arg != null ? Arrays.stream(route_hints_arg).mapToLong(route_hints_arg_conv_11 -> route_hints_arg_conv_11 == null ? 0 : route_hints_arg_conv_11.ptr & ~1).toArray() : null, expiry_time_arg.ptr); + Reference.reachabilityFence(pubkey_arg); + Reference.reachabilityFence(features_arg); + Reference.reachabilityFence(route_hints_arg); + Reference.reachabilityFence(expiry_time_arg); if (ret >= 0 && ret <= 4096) { return null; } Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -120,6 +137,7 @@ public class Payee extends CommonBase { long clone_ptr() { long ret = bindings.Payee_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -128,6 +146,7 @@ public class Payee extends CommonBase { */ public Payee clone() { long ret = bindings.Payee_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -139,9 +158,13 @@ public class Payee extends CommonBase { */ public long hash() { long ret = bindings.Payee_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two Payees contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -149,15 +172,22 @@ public class Payee extends CommonBase { */ public boolean eq(Payee b) { boolean ret = bindings.Payee_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Payee)) return false; + return this.eq((Payee)o); + } /** * Serialize the Payee object into a byte array which can be read by Payee_read */ public byte[] write() { byte[] ret = bindings.Payee_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -166,6 +196,7 @@ public class Payee extends CommonBase { */ public static Result_PayeeDecodeErrorZ read(byte[] ser) { long ret = bindings.Payee_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -176,6 +207,7 @@ public class Payee extends CommonBase { */ public static Payee from_node_id(byte[] pubkey) { long ret = bindings.Payee_from_node_id(InternalUtils.check_arr_len(pubkey, 33)); + Reference.reachabilityFence(pubkey); if (ret >= 0 && ret <= 4096) { return null; } Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -187,6 +219,7 @@ public class Payee extends CommonBase { */ public static Payee for_keysend(byte[] pubkey) { long ret = bindings.Payee_for_keysend(InternalUtils.check_arr_len(pubkey, 33)); + Reference.reachabilityFence(pubkey); if (ret >= 0 && ret <= 4096) { return null; } Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/PayeePubKey.java b/src/main/java/org/ldk/structs/PayeePubKey.java index 3f1ef322..edcadd5e 100644 --- a/src/main/java/org/ldk/structs/PayeePubKey.java +++ b/src/main/java/org/ldk/structs/PayeePubKey.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,11 +22,14 @@ public class PayeePubKey extends CommonBase { public byte[] get_a() { byte[] ret = bindings.PayeePubKey_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } public void set_a(byte[] val) { bindings.PayeePubKey_set_a(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -33,6 +37,7 @@ public class PayeePubKey extends CommonBase { */ public static PayeePubKey of(byte[] a_arg) { long ret = bindings.PayeePubKey_new(InternalUtils.check_arr_len(a_arg, 33)); + Reference.reachabilityFence(a_arg); if (ret >= 0 && ret <= 4096) { return null; } PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -41,6 +46,7 @@ public class PayeePubKey extends CommonBase { long clone_ptr() { long ret = bindings.PayeePubKey_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +55,7 @@ public class PayeePubKey extends CommonBase { */ public PayeePubKey clone() { long ret = bindings.PayeePubKey_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -60,9 +67,13 @@ public class PayeePubKey extends CommonBase { */ public long hash() { long ret = bindings.PayeePubKey_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two PayeePubKeys contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -70,8 +81,14 @@ public class PayeePubKey extends CommonBase { */ public boolean eq(PayeePubKey b) { boolean ret = bindings.PayeePubKey_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof PayeePubKey)) return false; + return this.eq((PayeePubKey)o); + } } diff --git a/src/main/java/org/ldk/structs/Payer.java b/src/main/java/org/ldk/structs/Payer.java index 4d488e92..2af7e3e7 100644 --- a/src/main/java/org/ldk/structs/Payer.java +++ b/src/main/java/org/ldk/structs/Payer.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -38,10 +39,18 @@ public class Payer extends CommonBase { * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ Result_PaymentIdPaymentSendFailureZ send_payment(Route route, byte[] payment_hash, byte[] payment_secret); + /** + * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. + */ + Result_PaymentIdPaymentSendFailureZ send_spontaneous_payment(Route route, byte[] payment_preimage); /** * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. */ Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id); + /** + * Signals that no further retries for the given payment will occur. + */ + void abandon_payment(byte[] payment_id); } private static class LDKPayerHolder { Payer held; } public static Payer new_impl(PayerInterface arg) { @@ -63,12 +72,21 @@ public class Payer extends CommonBase { long result = ret == null ? 0 : ret.clone_ptr(); return result; } + @Override public long send_spontaneous_payment(long route, byte[] payment_preimage) { + Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new Route(null, route); } + Result_PaymentIdPaymentSendFailureZ ret = arg.send_spontaneous_payment(route_hu_conv, payment_preimage); + long result = ret == null ? 0 : ret.clone_ptr(); + return result; + } @Override public long retry_payment(long route, byte[] payment_id) { Route route_hu_conv = null; if (route < 0 || route > 4096) { route_hu_conv = new Route(null, route); } Result_NonePaymentSendFailureZ ret = arg.retry_payment(route_hu_conv, payment_id); long result = ret == null ? 0 : ret.clone_ptr(); return result; } + @Override public void abandon_payment(byte[] payment_id) { + arg.abandon_payment(payment_id); + } }); return impl_holder.held; } @@ -77,6 +95,7 @@ public class Payer extends CommonBase { */ public byte[] node_id() { byte[] ret = bindings.Payer_node_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -85,6 +104,7 @@ public class Payer extends CommonBase { */ public ChannelDetails[] first_hops() { long[] ret = bindings.Payer_first_hops(this.ptr); + Reference.reachabilityFence(this); ChannelDetails[] ret_conv_16_arr = new ChannelDetails[ret.length]; for (int q = 0; q < ret.length; q++) { long ret_conv_16 = ret[q]; @@ -102,6 +122,24 @@ public class Payer extends CommonBase { */ public Result_PaymentIdPaymentSendFailureZ send_payment(Route route, byte[] payment_hash, @Nullable byte[] payment_secret) { long ret = bindings.Payer_send_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(payment_secret); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + this.ptrs_to.add(route); + return ret_hu_conv; + } + + /** + * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. + */ + public Result_PaymentIdPaymentSendFailureZ send_spontaneous_payment(Route route, byte[] payment_preimage) { + long ret = bindings.Payer_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_preimage, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_preimage); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); @@ -113,10 +151,22 @@ public class Payer extends CommonBase { */ public Result_NonePaymentSendFailureZ retry_payment(Route route, byte[] payment_id) { long ret = bindings.Payer_retry_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(route); + Reference.reachabilityFence(payment_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); this.ptrs_to.add(route); return ret_hu_conv; } + /** + * Signals that no further retries for the given payment will occur. + */ + public void abandon_payment(byte[] payment_id) { + bindings.Payer_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payment_id); + } + } diff --git a/src/main/java/org/ldk/structs/PaymentError.java b/src/main/java/org/ldk/structs/PaymentError.java index 7f1d4935..32b3ebc3 100644 --- a/src/main/java/org/ldk/structs/PaymentError.java +++ b/src/main/java/org/ldk/structs/PaymentError.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -70,6 +71,7 @@ public class PaymentError extends CommonBase { } long clone_ptr() { long ret = bindings.PaymentError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -78,6 +80,7 @@ public class PaymentError extends CommonBase { */ public PaymentError clone() { long ret = bindings.PaymentError_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -89,6 +92,7 @@ public class PaymentError extends CommonBase { */ public static PaymentError invoice(java.lang.String a) { long ret = bindings.PaymentError_invoice(a); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -100,6 +104,7 @@ public class PaymentError extends CommonBase { */ public static PaymentError routing(LightningError a) { long ret = bindings.PaymentError_routing(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -111,6 +116,7 @@ public class PaymentError extends CommonBase { */ public static PaymentError sending(PaymentSendFailure a) { long ret = bindings.PaymentError_sending(a.ptr); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentError ret_hu_conv = PaymentError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/PaymentPurpose.java b/src/main/java/org/ldk/structs/PaymentPurpose.java index 3c404af4..10bce274 100644 --- a/src/main/java/org/ldk/structs/PaymentPurpose.java +++ b/src/main/java/org/ldk/structs/PaymentPurpose.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -58,22 +59,10 @@ public class PaymentPurpose extends CommonBase { * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash */ public final byte[] payment_secret; - /** - * This is the `user_payment_id` which was provided to - * [`ChannelManager::create_inbound_payment_for_hash`] or - * [`ChannelManager::create_inbound_payment`]. It has no meaning inside of LDK and is - * simply copied here. It may be used to correlate PaymentReceived events with invoice - * metadata stored elsewhere. - * - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash - */ - public final long user_payment_id; private InvoicePayment(long ptr, bindings.LDKPaymentPurpose.InvoicePayment obj) { super(null, ptr); this.payment_preimage = obj.payment_preimage; this.payment_secret = obj.payment_secret; - this.user_payment_id = obj.user_payment_id; } } /** @@ -89,6 +78,7 @@ public class PaymentPurpose extends CommonBase { } long clone_ptr() { long ret = bindings.PaymentPurpose_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -97,6 +87,7 @@ public class PaymentPurpose extends CommonBase { */ public PaymentPurpose clone() { long ret = bindings.PaymentPurpose_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -106,8 +97,10 @@ public class PaymentPurpose extends CommonBase { /** * Utility method to constructs a new InvoicePayment-variant PaymentPurpose */ - public static PaymentPurpose invoice_payment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id) { - long ret = bindings.PaymentPurpose_invoice_payment(InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_secret, 32), user_payment_id); + public static PaymentPurpose invoice_payment(byte[] payment_preimage, byte[] payment_secret) { + long ret = bindings.PaymentPurpose_invoice_payment(InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_secret, 32)); + Reference.reachabilityFence(payment_preimage); + Reference.reachabilityFence(payment_secret); if (ret >= 0 && ret <= 4096) { return null; } PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -119,6 +112,7 @@ public class PaymentPurpose extends CommonBase { */ public static PaymentPurpose spontaneous_payment(byte[] a) { long ret = bindings.PaymentPurpose_spontaneous_payment(InternalUtils.check_arr_len(a, 32)); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/PaymentSendFailure.java b/src/main/java/org/ldk/structs/PaymentSendFailure.java index 1328b96e..c87afdf0 100644 --- a/src/main/java/org/ldk/structs/PaymentSendFailure.java +++ b/src/main/java/org/ldk/structs/PaymentSendFailure.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -145,6 +146,7 @@ public class PaymentSendFailure extends CommonBase { } long clone_ptr() { long ret = bindings.PaymentSendFailure_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -153,6 +155,7 @@ public class PaymentSendFailure extends CommonBase { */ public PaymentSendFailure clone() { long ret = bindings.PaymentSendFailure_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -164,6 +167,7 @@ public class PaymentSendFailure extends CommonBase { */ public static PaymentSendFailure parameter_error(APIError a) { long ret = bindings.PaymentSendFailure_parameter_error(a.ptr); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -175,6 +179,7 @@ public class PaymentSendFailure extends CommonBase { */ public static PaymentSendFailure path_parameter_error(Result_NoneAPIErrorZ[] a) { long ret = bindings.PaymentSendFailure_path_parameter_error(a != null ? Arrays.stream(a).mapToLong(a_conv_22 -> a_conv_22 != null ? a_conv_22.ptr : 0).toArray() : null); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -186,6 +191,7 @@ public class PaymentSendFailure extends CommonBase { */ public static PaymentSendFailure all_failed_retry_safe(APIError[] a) { long ret = bindings.PaymentSendFailure_all_failed_retry_safe(a != null ? Arrays.stream(a).mapToLong(a_conv_10 -> a_conv_10.ptr).toArray() : null); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -197,6 +203,9 @@ public class PaymentSendFailure extends CommonBase { */ public static PaymentSendFailure partial_failure(Result_NoneAPIErrorZ[] results, RouteParameters failed_paths_retry, byte[] payment_id) { long ret = bindings.PaymentSendFailure_partial_failure(results != null ? Arrays.stream(results).mapToLong(results_conv_22 -> results_conv_22 != null ? results_conv_22.ptr : 0).toArray() : null, failed_paths_retry == null ? 0 : failed_paths_retry.ptr & ~1, InternalUtils.check_arr_len(payment_id, 32)); + Reference.reachabilityFence(results); + Reference.reachabilityFence(failed_paths_retry); + Reference.reachabilityFence(payment_id); if (ret >= 0 && ret <= 4096) { return null; } PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/PeerHandleError.java b/src/main/java/org/ldk/structs/PeerHandleError.java index 42073113..e9dda3f2 100644 --- a/src/main/java/org/ldk/structs/PeerHandleError.java +++ b/src/main/java/org/ldk/structs/PeerHandleError.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class PeerHandleError extends CommonBase { */ public boolean get_no_connection_possible() { boolean ret = bindings.PeerHandleError_get_no_connection_possible(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -36,6 +38,8 @@ public class PeerHandleError extends CommonBase { */ public void set_no_connection_possible(boolean val) { bindings.PeerHandleError_set_no_connection_possible(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,7 @@ public class PeerHandleError extends CommonBase { */ public static PeerHandleError of(boolean no_connection_possible_arg) { long ret = bindings.PeerHandleError_new(no_connection_possible_arg); + Reference.reachabilityFence(no_connection_possible_arg); if (ret >= 0 && ret <= 4096) { return null; } PeerHandleError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PeerHandleError(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -51,6 +56,7 @@ public class PeerHandleError extends CommonBase { long clone_ptr() { long ret = bindings.PeerHandleError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -59,6 +65,7 @@ public class PeerHandleError extends CommonBase { */ public PeerHandleError clone() { long ret = bindings.PeerHandleError_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PeerHandleError ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PeerHandleError(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/PeerManager.java b/src/main/java/org/ldk/structs/PeerManager.java index 7038d5b8..be267b56 100644 --- a/src/main/java/org/ldk/structs/PeerManager.java +++ b/src/main/java/org/ldk/structs/PeerManager.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -44,6 +45,12 @@ public class PeerManager extends CommonBase { */ public static PeerManager of(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, byte[] our_node_secret, byte[] ephemeral_random_data, Logger logger, CustomMessageHandler custom_message_handler) { long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr), InternalUtils.check_arr_len(our_node_secret, 32), InternalUtils.check_arr_len(ephemeral_random_data, 32), logger == null ? 0 : logger.ptr, custom_message_handler == null ? 0 : custom_message_handler.ptr); + Reference.reachabilityFence(message_handler_chan_handler_arg); + Reference.reachabilityFence(message_handler_route_handler_arg); + Reference.reachabilityFence(our_node_secret); + Reference.reachabilityFence(ephemeral_random_data); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(custom_message_handler); if (ret >= 0 && ret <= 4096) { return null; } PeerManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PeerManager(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -63,6 +70,7 @@ public class PeerManager extends CommonBase { */ public byte[][] get_peer_node_ids() { byte[][] ret = bindings.PeerManager_get_peer_node_ids(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +88,9 @@ public class PeerManager extends CommonBase { */ public Result_CVec_u8ZPeerHandleErrorZ new_outbound_connection(byte[] their_node_id, SocketDescriptor descriptor) { long ret = bindings.PeerManager_new_outbound_connection(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), descriptor == null ? 0 : descriptor.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); this.ptrs_to.add(descriptor); @@ -101,6 +112,8 @@ public class PeerManager extends CommonBase { */ public Result_NonePeerHandleErrorZ new_inbound_connection(SocketDescriptor descriptor) { long ret = bindings.PeerManager_new_inbound_connection(this.ptr, descriptor == null ? 0 : descriptor.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePeerHandleErrorZ ret_hu_conv = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); this.ptrs_to.add(descriptor); @@ -123,6 +136,8 @@ public class PeerManager extends CommonBase { */ public Result_NonePeerHandleErrorZ write_buffer_space_avail(SocketDescriptor descriptor) { long ret = bindings.PeerManager_write_buffer_space_avail(this.ptr, descriptor == null ? 0 : descriptor.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(descriptor); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePeerHandleErrorZ ret_hu_conv = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -146,6 +161,9 @@ public class PeerManager extends CommonBase { */ public Result_boolPeerHandleErrorZ read_event(SocketDescriptor peer_descriptor, byte[] data) { long ret = bindings.PeerManager_read_event(this.ptr, peer_descriptor == null ? 0 : peer_descriptor.ptr, data); + Reference.reachabilityFence(this); + Reference.reachabilityFence(peer_descriptor); + Reference.reachabilityFence(data); if (ret >= 0 && ret <= 4096) { return null; } Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -168,6 +186,7 @@ public class PeerManager extends CommonBase { */ public void process_events() { bindings.PeerManager_process_events(this.ptr); + Reference.reachabilityFence(this); } /** @@ -175,6 +194,8 @@ public class PeerManager extends CommonBase { */ public void socket_disconnected(SocketDescriptor descriptor) { bindings.PeerManager_socket_disconnected(this.ptr, descriptor == null ? 0 : descriptor.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(descriptor); } /** @@ -190,6 +211,9 @@ public class PeerManager extends CommonBase { */ public void disconnect_by_node_id(byte[] node_id, boolean no_connection_possible) { bindings.PeerManager_disconnect_by_node_id(this.ptr, InternalUtils.check_arr_len(node_id, 33), no_connection_possible); + Reference.reachabilityFence(this); + Reference.reachabilityFence(node_id); + Reference.reachabilityFence(no_connection_possible); } /** @@ -199,6 +223,7 @@ public class PeerManager extends CommonBase { */ public void disconnect_all_peers() { bindings.PeerManager_disconnect_all_peers(this.ptr); + Reference.reachabilityFence(this); } /** @@ -216,6 +241,7 @@ public class PeerManager extends CommonBase { */ public void timer_tick_occurred() { bindings.PeerManager_timer_tick_occurred(this.ptr); + Reference.reachabilityFence(this); } } diff --git a/src/main/java/org/ldk/structs/Persist.java b/src/main/java/org/ldk/structs/Persist.java index 416db9bd..0237bcb2 100644 --- a/src/main/java/org/ldk/structs/Persist.java +++ b/src/main/java/org/ldk/structs/Persist.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -146,6 +147,10 @@ public class Persist extends CommonBase { */ public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint channel_id, ChannelMonitor data, MonitorUpdateId update_id) { long ret = bindings.Persist_persist_new_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr & ~1, data == null ? 0 : data.ptr & ~1, update_id == null ? 0 : update_id.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_id); + Reference.reachabilityFence(data); + Reference.reachabilityFence(update_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); this.ptrs_to.add(data); @@ -191,6 +196,11 @@ public class Persist extends CommonBase { */ public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint channel_id, @Nullable ChannelMonitorUpdate update, ChannelMonitor data, MonitorUpdateId update_id) { long ret = bindings.Persist_update_persisted_channel(this.ptr, channel_id == null ? 0 : channel_id.ptr & ~1, update == null ? 0 : update.ptr & ~1, data == null ? 0 : data.ptr & ~1, update_id == null ? 0 : update_id.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(channel_id); + Reference.reachabilityFence(update); + Reference.reachabilityFence(data); + Reference.reachabilityFence(update_id); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); this.ptrs_to.add(update); diff --git a/src/main/java/org/ldk/structs/Ping.java b/src/main/java/org/ldk/structs/Ping.java index 8212fec0..f7ab7efb 100644 --- a/src/main/java/org/ldk/structs/Ping.java +++ b/src/main/java/org/ldk/structs/Ping.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class Ping extends CommonBase { */ public short get_ponglen() { short ret = bindings.Ping_get_ponglen(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class Ping extends CommonBase { */ public void set_ponglen(short val) { bindings.Ping_set_ponglen(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -40,6 +44,7 @@ public class Ping extends CommonBase { */ public short get_byteslen() { short ret = bindings.Ping_get_byteslen(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +54,8 @@ public class Ping extends CommonBase { */ public void set_byteslen(short val) { bindings.Ping_set_byteslen(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -56,6 +63,8 @@ public class Ping extends CommonBase { */ public static Ping of(short ponglen_arg, short byteslen_arg) { long ret = bindings.Ping_new(ponglen_arg, byteslen_arg); + Reference.reachabilityFence(ponglen_arg); + Reference.reachabilityFence(byteslen_arg); if (ret >= 0 && ret <= 4096) { return null; } Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Ping(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -64,6 +73,7 @@ public class Ping extends CommonBase { long clone_ptr() { long ret = bindings.Ping_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +82,7 @@ public class Ping extends CommonBase { */ public Ping clone() { long ret = bindings.Ping_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Ping ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Ping(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -83,6 +94,7 @@ public class Ping extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Ping_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -91,6 +103,7 @@ public class Ping extends CommonBase { */ public static Result_PingDecodeErrorZ read(byte[] ser) { long ret = bindings.Ping_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Pong.java b/src/main/java/org/ldk/structs/Pong.java index ac695f22..9e32c65a 100644 --- a/src/main/java/org/ldk/structs/Pong.java +++ b/src/main/java/org/ldk/structs/Pong.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class Pong extends CommonBase { */ public short get_byteslen() { short ret = bindings.Pong_get_byteslen(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -34,6 +36,8 @@ public class Pong extends CommonBase { */ public void set_byteslen(short val) { bindings.Pong_set_byteslen(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -41,6 +45,7 @@ public class Pong extends CommonBase { */ public static Pong of(short byteslen_arg) { long ret = bindings.Pong_new(byteslen_arg); + Reference.reachabilityFence(byteslen_arg); if (ret >= 0 && ret <= 4096) { return null; } Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Pong(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -49,6 +54,7 @@ public class Pong extends CommonBase { long clone_ptr() { long ret = bindings.Pong_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -57,6 +63,7 @@ public class Pong extends CommonBase { */ public Pong clone() { long ret = bindings.Pong_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Pong ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Pong(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -68,6 +75,7 @@ public class Pong extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Pong_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -76,6 +84,7 @@ public class Pong extends CommonBase { */ public static Result_PongDecodeErrorZ read(byte[] ser) { long ret = bindings.Pong_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/PositiveTimestamp.java b/src/main/java/org/ldk/structs/PositiveTimestamp.java index 3113fe77..dd04d046 100644 --- a/src/main/java/org/ldk/structs/PositiveTimestamp.java +++ b/src/main/java/org/ldk/structs/PositiveTimestamp.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -31,12 +32,19 @@ public class PositiveTimestamp extends CommonBase { */ public boolean eq(PositiveTimestamp b) { boolean ret = bindings.PositiveTimestamp_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof PositiveTimestamp)) return false; + return this.eq((PositiveTimestamp)o); + } long clone_ptr() { long ret = bindings.PositiveTimestamp_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -45,6 +53,7 @@ public class PositiveTimestamp extends CommonBase { */ public PositiveTimestamp clone() { long ret = bindings.PositiveTimestamp_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PositiveTimestamp ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PositiveTimestamp(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -58,6 +67,7 @@ public class PositiveTimestamp extends CommonBase { */ public static Result_PositiveTimestampCreationErrorZ from_unix_timestamp(long unix_seconds) { long ret = bindings.PositiveTimestamp_from_unix_timestamp(unix_seconds); + Reference.reachabilityFence(unix_seconds); if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -70,6 +80,7 @@ public class PositiveTimestamp extends CommonBase { */ public static Result_PositiveTimestampCreationErrorZ from_system_time(long time) { long ret = bindings.PositiveTimestamp_from_system_time(time); + Reference.reachabilityFence(time); if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -80,6 +91,7 @@ public class PositiveTimestamp extends CommonBase { */ public long as_unix_timestamp() { long ret = bindings.PositiveTimestamp_as_unix_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -88,6 +100,7 @@ public class PositiveTimestamp extends CommonBase { */ public long as_time() { long ret = bindings.PositiveTimestamp_as_time(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/PrivateRoute.java b/src/main/java/org/ldk/structs/PrivateRoute.java index c4f11b6c..060e8b16 100644 --- a/src/main/java/org/ldk/structs/PrivateRoute.java +++ b/src/main/java/org/ldk/structs/PrivateRoute.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class PrivateRoute extends CommonBase { long clone_ptr() { long ret = bindings.PrivateRoute_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class PrivateRoute extends CommonBase { */ public PrivateRoute clone() { long ret = bindings.PrivateRoute_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PrivateRoute ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PrivateRoute(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -43,9 +46,13 @@ public class PrivateRoute extends CommonBase { */ public long hash() { long ret = bindings.PrivateRoute_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two PrivateRoutes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -53,15 +60,22 @@ public class PrivateRoute extends CommonBase { */ public boolean eq(PrivateRoute b) { boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof PrivateRoute)) return false; + return this.eq((PrivateRoute)o); + } /** * Creates a new (partial) route from a list of hops */ public static Result_PrivateRouteCreationErrorZ of(RouteHint hops) { long ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1); + Reference.reachabilityFence(hops); if (ret >= 0 && ret <= 4096) { return null; } Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -72,6 +86,7 @@ public class PrivateRoute extends CommonBase { */ public RouteHint into_inner() { long ret = bindings.PrivateRoute_into_inner(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/QueryChannelRange.java b/src/main/java/org/ldk/structs/QueryChannelRange.java index b378c84a..fb7b8060 100644 --- a/src/main/java/org/ldk/structs/QueryChannelRange.java +++ b/src/main/java/org/ldk/structs/QueryChannelRange.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class QueryChannelRange extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.QueryChannelRange_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -35,6 +37,8 @@ public class QueryChannelRange extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.QueryChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class QueryChannelRange extends CommonBase { */ public int get_first_blocknum() { int ret = bindings.QueryChannelRange_get_first_blocknum(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class QueryChannelRange extends CommonBase { */ public void set_first_blocknum(int val) { bindings.QueryChannelRange_set_first_blocknum(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,7 @@ public class QueryChannelRange extends CommonBase { */ public int get_number_of_blocks() { int ret = bindings.QueryChannelRange_get_number_of_blocks(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -65,6 +73,8 @@ public class QueryChannelRange extends CommonBase { */ public void set_number_of_blocks(int val) { bindings.QueryChannelRange_set_number_of_blocks(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +82,9 @@ public class QueryChannelRange extends CommonBase { */ public static QueryChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg) { long ret = bindings.QueryChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg); + Reference.reachabilityFence(chain_hash_arg); + Reference.reachabilityFence(first_blocknum_arg); + Reference.reachabilityFence(number_of_blocks_arg); if (ret >= 0 && ret <= 4096) { return null; } QueryChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryChannelRange(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -80,6 +93,7 @@ public class QueryChannelRange extends CommonBase { long clone_ptr() { long ret = bindings.QueryChannelRange_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -88,6 +102,7 @@ public class QueryChannelRange extends CommonBase { */ public QueryChannelRange clone() { long ret = bindings.QueryChannelRange_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } QueryChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryChannelRange(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -99,6 +114,7 @@ public class QueryChannelRange extends CommonBase { */ public int end_blocknum() { int ret = bindings.QueryChannelRange_end_blocknum(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -107,6 +123,7 @@ public class QueryChannelRange extends CommonBase { */ public byte[] write() { byte[] ret = bindings.QueryChannelRange_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -115,6 +132,7 @@ public class QueryChannelRange extends CommonBase { */ public static Result_QueryChannelRangeDecodeErrorZ read(byte[] ser) { long ret = bindings.QueryChannelRange_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/QueryShortChannelIds.java b/src/main/java/org/ldk/structs/QueryShortChannelIds.java index 194cbc5f..aeb49aae 100644 --- a/src/main/java/org/ldk/structs/QueryShortChannelIds.java +++ b/src/main/java/org/ldk/structs/QueryShortChannelIds.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -31,6 +32,7 @@ public class QueryShortChannelIds extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.QueryShortChannelIds_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -39,6 +41,8 @@ public class QueryShortChannelIds extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.QueryShortChannelIds_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -46,6 +50,8 @@ public class QueryShortChannelIds extends CommonBase { */ public void set_short_channel_ids(long[] val) { bindings.QueryShortChannelIds_set_short_channel_ids(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -53,6 +59,8 @@ public class QueryShortChannelIds extends CommonBase { */ public static QueryShortChannelIds of(byte[] chain_hash_arg, long[] short_channel_ids_arg) { long ret = bindings.QueryShortChannelIds_new(InternalUtils.check_arr_len(chain_hash_arg, 32), short_channel_ids_arg); + Reference.reachabilityFence(chain_hash_arg); + Reference.reachabilityFence(short_channel_ids_arg); if (ret >= 0 && ret <= 4096) { return null; } QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryShortChannelIds(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -61,6 +69,7 @@ public class QueryShortChannelIds extends CommonBase { long clone_ptr() { long ret = bindings.QueryShortChannelIds_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -69,6 +78,7 @@ public class QueryShortChannelIds extends CommonBase { */ public QueryShortChannelIds clone() { long ret = bindings.QueryShortChannelIds_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } QueryShortChannelIds ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new QueryShortChannelIds(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -80,6 +90,7 @@ public class QueryShortChannelIds extends CommonBase { */ public static Result_QueryShortChannelIdsDecodeErrorZ read(byte[] ser) { long ret = bindings.QueryShortChannelIds_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -90,6 +101,7 @@ public class QueryShortChannelIds extends CommonBase { */ public byte[] write() { byte[] ret = bindings.QueryShortChannelIds_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/RawDataPart.java b/src/main/java/org/ldk/structs/RawDataPart.java index 340fc191..e79d9a61 100644 --- a/src/main/java/org/ldk/structs/RawDataPart.java +++ b/src/main/java/org/ldk/structs/RawDataPart.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class RawDataPart extends CommonBase { */ public PositiveTimestamp get_timestamp() { long ret = bindings.RawDataPart_get_timestamp(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PositiveTimestamp ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PositiveTimestamp(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,8 @@ public class RawDataPart extends CommonBase { */ public void set_timestamp(PositiveTimestamp val) { bindings.RawDataPart_set_timestamp(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -44,12 +48,19 @@ public class RawDataPart extends CommonBase { */ public boolean eq(RawDataPart b) { boolean ret = bindings.RawDataPart_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RawDataPart)) return false; + return this.eq((RawDataPart)o); + } long clone_ptr() { long ret = bindings.RawDataPart_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -58,6 +69,7 @@ public class RawDataPart extends CommonBase { */ public RawDataPart clone() { long ret = bindings.RawDataPart_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawDataPart(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/RawInvoice.java b/src/main/java/org/ldk/structs/RawInvoice.java index 00082036..6d421f6d 100644 --- a/src/main/java/org/ldk/structs/RawInvoice.java +++ b/src/main/java/org/ldk/structs/RawInvoice.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -28,6 +29,7 @@ public class RawInvoice extends CommonBase { */ public RawDataPart get_data() { long ret = bindings.RawInvoice_get_data(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RawDataPart ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawDataPart(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -39,6 +41,8 @@ public class RawInvoice extends CommonBase { */ public void set_data(RawDataPart val) { bindings.RawInvoice_set_data(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -48,12 +52,19 @@ public class RawInvoice extends CommonBase { */ public boolean eq(RawInvoice b) { boolean ret = bindings.RawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RawInvoice)) return false; + return this.eq((RawInvoice)o); + } long clone_ptr() { long ret = bindings.RawInvoice_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +73,7 @@ public class RawInvoice extends CommonBase { */ public RawInvoice clone() { long ret = bindings.RawInvoice_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawInvoice(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -73,6 +85,7 @@ public class RawInvoice extends CommonBase { */ public byte[] hash() { byte[] ret = bindings.RawInvoice_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -82,6 +95,7 @@ public class RawInvoice extends CommonBase { @Nullable public Sha256 payment_hash() { long ret = bindings.RawInvoice_payment_hash(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -94,6 +108,7 @@ public class RawInvoice extends CommonBase { @Nullable public Description description() { long ret = bindings.RawInvoice_description(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Description ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Description(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -106,6 +121,7 @@ public class RawInvoice extends CommonBase { @Nullable public PayeePubKey payee_pub_key() { long ret = bindings.RawInvoice_payee_pub_key(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } PayeePubKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new PayeePubKey(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -118,6 +134,7 @@ public class RawInvoice extends CommonBase { @Nullable public Sha256 description_hash() { long ret = bindings.RawInvoice_description_hash(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -130,6 +147,7 @@ public class RawInvoice extends CommonBase { @Nullable public ExpiryTime expiry_time() { long ret = bindings.RawInvoice_expiry_time(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ExpiryTime ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ExpiryTime(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -142,6 +160,7 @@ public class RawInvoice extends CommonBase { @Nullable public MinFinalCltvExpiry min_final_cltv_expiry() { long ret = bindings.RawInvoice_min_final_cltv_expiry(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } MinFinalCltvExpiry ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new MinFinalCltvExpiry(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -154,6 +173,7 @@ public class RawInvoice extends CommonBase { @Nullable public byte[] payment_secret() { byte[] ret = bindings.RawInvoice_payment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -163,6 +183,7 @@ public class RawInvoice extends CommonBase { @Nullable public InvoiceFeatures features() { long ret = bindings.RawInvoice_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -171,6 +192,7 @@ public class RawInvoice extends CommonBase { public PrivateRoute[] private_routes() { long[] ret = bindings.RawInvoice_private_routes(this.ptr); + Reference.reachabilityFence(this); PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length]; for (int o = 0; o < ret.length; o++) { long ret_conv_14 = ret[o]; @@ -183,6 +205,7 @@ public class RawInvoice extends CommonBase { public Option_u64Z amount_pico_btc() { long ret = bindings.RawInvoice_amount_pico_btc(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -191,6 +214,7 @@ public class RawInvoice extends CommonBase { public Currency currency() { Currency ret = bindings.RawInvoice_currency(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java index 9c3bf743..5817a099 100644 --- a/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java +++ b/src/main/java/org/ldk/structs/ReadOnlyNetworkGraph.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -26,6 +27,8 @@ public class ReadOnlyNetworkGraph extends CommonBase { */ public Option_CVec_NetAddressZZ get_addresses(byte[] pubkey) { long ret = bindings.ReadOnlyNetworkGraph_get_addresses(this.ptr, InternalUtils.check_arr_len(pubkey, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(pubkey); if (ret >= 0 && ret <= 4096) { return null; } Option_CVec_NetAddressZZ ret_hu_conv = Option_CVec_NetAddressZZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/Record.java b/src/main/java/org/ldk/structs/Record.java index deefa464..fc75ebd2 100644 --- a/src/main/java/org/ldk/structs/Record.java +++ b/src/main/java/org/ldk/structs/Record.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class Record extends CommonBase { */ public Level get_level() { Level ret = bindings.Record_get_level(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -33,6 +35,8 @@ public class Record extends CommonBase { */ public void set_level(org.ldk.enums.Level val) { bindings.Record_set_level(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -40,6 +44,7 @@ public class Record extends CommonBase { */ public String get_args() { String ret = bindings.Record_get_args(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -48,6 +53,8 @@ public class Record extends CommonBase { */ public void set_args(java.lang.String val) { bindings.Record_set_args(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -55,6 +62,7 @@ public class Record extends CommonBase { */ public String get_module_path() { String ret = bindings.Record_get_module_path(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -63,6 +71,8 @@ public class Record extends CommonBase { */ public void set_module_path(java.lang.String val) { bindings.Record_set_module_path(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -70,6 +80,7 @@ public class Record extends CommonBase { */ public String get_file() { String ret = bindings.Record_get_file(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -78,6 +89,8 @@ public class Record extends CommonBase { */ public void set_file(java.lang.String val) { bindings.Record_set_file(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -85,6 +98,7 @@ public class Record extends CommonBase { */ public int get_line() { int ret = bindings.Record_get_line(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -93,10 +107,13 @@ public class Record extends CommonBase { */ public void set_line(int val) { bindings.Record_set_line(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.Record_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -105,6 +122,7 @@ public class Record extends CommonBase { */ public Record clone() { long ret = bindings.Record_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Record ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Record(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/ReplyChannelRange.java b/src/main/java/org/ldk/structs/ReplyChannelRange.java index a539c890..59f11a75 100644 --- a/src/main/java/org/ldk/structs/ReplyChannelRange.java +++ b/src/main/java/org/ldk/structs/ReplyChannelRange.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -30,6 +31,7 @@ public class ReplyChannelRange extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.ReplyChannelRange_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -38,6 +40,8 @@ public class ReplyChannelRange extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.ReplyChannelRange_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -45,6 +49,7 @@ public class ReplyChannelRange extends CommonBase { */ public int get_first_blocknum() { int ret = bindings.ReplyChannelRange_get_first_blocknum(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +58,8 @@ public class ReplyChannelRange extends CommonBase { */ public void set_first_blocknum(int val) { bindings.ReplyChannelRange_set_first_blocknum(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -60,6 +67,7 @@ public class ReplyChannelRange extends CommonBase { */ public int get_number_of_blocks() { int ret = bindings.ReplyChannelRange_get_number_of_blocks(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -68,6 +76,8 @@ public class ReplyChannelRange extends CommonBase { */ public void set_number_of_blocks(int val) { bindings.ReplyChannelRange_set_number_of_blocks(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -75,6 +85,7 @@ public class ReplyChannelRange extends CommonBase { */ public boolean get_sync_complete() { boolean ret = bindings.ReplyChannelRange_get_sync_complete(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +94,8 @@ public class ReplyChannelRange extends CommonBase { */ public void set_sync_complete(boolean val) { bindings.ReplyChannelRange_set_sync_complete(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -90,6 +103,8 @@ public class ReplyChannelRange extends CommonBase { */ public void set_short_channel_ids(long[] val) { bindings.ReplyChannelRange_set_short_channel_ids(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -97,6 +112,11 @@ public class ReplyChannelRange extends CommonBase { */ public static ReplyChannelRange of(byte[] chain_hash_arg, int first_blocknum_arg, int number_of_blocks_arg, boolean sync_complete_arg, long[] short_channel_ids_arg) { long ret = bindings.ReplyChannelRange_new(InternalUtils.check_arr_len(chain_hash_arg, 32), first_blocknum_arg, number_of_blocks_arg, sync_complete_arg, short_channel_ids_arg); + Reference.reachabilityFence(chain_hash_arg); + Reference.reachabilityFence(first_blocknum_arg); + Reference.reachabilityFence(number_of_blocks_arg); + Reference.reachabilityFence(sync_complete_arg); + Reference.reachabilityFence(short_channel_ids_arg); if (ret >= 0 && ret <= 4096) { return null; } ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReplyChannelRange(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -105,6 +125,7 @@ public class ReplyChannelRange extends CommonBase { long clone_ptr() { long ret = bindings.ReplyChannelRange_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -113,6 +134,7 @@ public class ReplyChannelRange extends CommonBase { */ public ReplyChannelRange clone() { long ret = bindings.ReplyChannelRange_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ReplyChannelRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReplyChannelRange(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -124,6 +146,7 @@ public class ReplyChannelRange extends CommonBase { */ public static Result_ReplyChannelRangeDecodeErrorZ read(byte[] ser) { long ret = bindings.ReplyChannelRange_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -134,6 +157,7 @@ public class ReplyChannelRange extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ReplyChannelRange_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java index 8d0e5bc7..eaeef3f4 100644 --- a/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java +++ b/src/main/java/org/ldk/structs/ReplyShortChannelIdsEnd.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.ReplyShortChannelIdsEnd_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -35,6 +37,8 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.ReplyShortChannelIdsEnd_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public boolean get_full_information() { boolean ret = bindings.ReplyShortChannelIdsEnd_get_full_information(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -52,6 +57,8 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public void set_full_information(boolean val) { bindings.ReplyShortChannelIdsEnd_set_full_information(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -59,6 +66,8 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public static ReplyShortChannelIdsEnd of(byte[] chain_hash_arg, boolean full_information_arg) { long ret = bindings.ReplyShortChannelIdsEnd_new(InternalUtils.check_arr_len(chain_hash_arg, 32), full_information_arg); + Reference.reachabilityFence(chain_hash_arg); + Reference.reachabilityFence(full_information_arg); if (ret >= 0 && ret <= 4096) { return null; } ReplyShortChannelIdsEnd ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReplyShortChannelIdsEnd(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -67,6 +76,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { long clone_ptr() { long ret = bindings.ReplyShortChannelIdsEnd_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +85,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public ReplyShortChannelIdsEnd clone() { long ret = bindings.ReplyShortChannelIdsEnd_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ReplyShortChannelIdsEnd ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ReplyShortChannelIdsEnd(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -86,6 +97,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ReplyShortChannelIdsEnd_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -94,6 +106,7 @@ public class ReplyShortChannelIdsEnd extends CommonBase { */ public static Result_ReplyShortChannelIdsEndDecodeErrorZ read(byte[] ser) { long ret = bindings.ReplyShortChannelIdsEnd_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java index 747f4783..aa152127 100644 --- a/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_AcceptChannelDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_AcceptChannelDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_AcceptChannelDecodeErrorZ extends CommonBase { */ public static Result_AcceptChannelDecodeErrorZ ok(AcceptChannel o) { long ret = bindings.CResult_AcceptChannelDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_AcceptChannelDecodeErrorZ extends CommonBase { */ public static Result_AcceptChannelDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_AcceptChannelDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_AcceptChannelDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_AcceptChannelDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_AcceptChannelDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_AcceptChannelDecodeErrorZ extends CommonBase { */ public Result_AcceptChannelDecodeErrorZ clone() { long ret = bindings.CResult_AcceptChannelDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_AcceptChannelDecodeErrorZ ret_hu_conv = Result_AcceptChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java index c49e049c..2609ba2a 100644 --- a/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_AnnouncementSignaturesDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { */ public static Result_AnnouncementSignaturesDecodeErrorZ ok(AnnouncementSignatures o) { long ret = bindings.CResult_AnnouncementSignaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_AnnouncementSignaturesDecodeErrorZ ret_hu_conv = Result_AnnouncementSignaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { */ public static Result_AnnouncementSignaturesDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_AnnouncementSignaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_AnnouncementSignaturesDecodeErrorZ ret_hu_conv = Result_AnnouncementSignaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_AnnouncementSignaturesDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_AnnouncementSignaturesDecodeErrorZ extends CommonBase { */ public Result_AnnouncementSignaturesDecodeErrorZ clone() { long ret = bindings.CResult_AnnouncementSignaturesDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_AnnouncementSignaturesDecodeErrorZ ret_hu_conv = Result_AnnouncementSignaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java index a7f81915..f3ae471c 100644 --- a/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_BuiltCommitmentTransactionDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { */ public static Result_BuiltCommitmentTransactionDecodeErrorZ ok(BuiltCommitmentTransaction o) { long ret = bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { */ public static Result_BuiltCommitmentTransactionDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_BuiltCommitmentTransactionDecodeErrorZ extends CommonBase { */ public Result_BuiltCommitmentTransactionDecodeErrorZ clone() { long ret = bindings.CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java index c3437d05..3ae0b96c 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ extends CommonB */ public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ok(TwoTuple_BlockHashChannelManagerZ o) { long ret = bindings.CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ extends CommonB */ public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,6 +69,7 @@ public class Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ extends CommonB */ public boolean is_ok() { boolean ret = bindings.CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java index f8542b69..89546431 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonB */ public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ok(TwoTuple_BlockHashChannelMonitorZ o) { long ret = bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonB */ public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonB */ public boolean is_ok() { boolean ret = bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonB */ public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ clone() { long ret = bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java index cb7baf31..40e25fce 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends Com */ public static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ok(TwoTuple_PaymentHashPaymentIdZ o) { long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends Com */ public static Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ err(PaymentSendFailure e) { long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends Com */ public boolean is_ok() { boolean ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ extends Com */ public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ clone() { long ret = bindings.CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java new file mode 100644 index 00000000..424de1d1 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.java @@ -0,0 +1,94 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ extends CommonBase { + private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(ptr); } super.finalize(); + } + + static Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(ptr)) { + return new Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_OK(null, ptr); + } else { + return new Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err(null, ptr); + } + } + public static final class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_OK extends Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { + public final TwoTuple_PaymentHashPaymentSecretZ res; + private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(ptr); + TwoTuple_PaymentHashPaymentSecretZ res_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err extends Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { + public final APIError err; + private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(ptr); + APIError err_hu_conv = APIError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. + */ + public static Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ok(TwoTuple_PaymentHashPaymentSecretZ o) { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. + */ + public static Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ err(APIError e) { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ clone() { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.java new file mode 100644 index 00000000..84281dc7 --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.java @@ -0,0 +1,88 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_C2Tuple_PaymentHashPaymentSecretZNoneZ extends CommonBase { + private Result_C2Tuple_PaymentHashPaymentSecretZNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(ptr); } super.finalize(); + } + + static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ constr_from_ptr(long ptr) { + if (bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(ptr)) { + return new Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_OK(null, ptr); + } else { + return new Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_Err(null, ptr); + } + } + public static final class Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_OK extends Result_C2Tuple_PaymentHashPaymentSecretZNoneZ { + public final TwoTuple_PaymentHashPaymentSecretZ res; + private Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(ptr); + TwoTuple_PaymentHashPaymentSecretZ res_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_Err extends Result_C2Tuple_PaymentHashPaymentSecretZNoneZ { + private Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. + */ + public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ok(TwoTuple_PaymentHashPaymentSecretZ o) { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. + */ + public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ err() { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ clone() { + long ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.java b/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.java index 771b80f5..e7301349 100644 --- a/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_C2Tuple_SignatureCVec_SignatureZZNoneZ extends CommonBase { @@ -41,6 +42,7 @@ public class Result_C2Tuple_SignatureCVec_SignatureZZNoneZ extends CommonBase { */ public static Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ok(TwoTuple_SignatureCVec_SignatureZZ o) { long ret = bindings.CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o != null ? o.ptr : 0); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_C2Tuple_SignatureCVec_SignatureZZNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_C2Tuple_SignatureCVec_SignatureZZNoneZ extends CommonBase { */ public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ clone() { long ret = bindings.CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java index c146dbcc..44febc37 100644 --- a/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_ClosureReasonZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { */ public static Result_COption_ClosureReasonZDecodeErrorZ ok(Option_ClosureReasonZ o) { long ret = bindings.CResult_COption_ClosureReasonZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { */ public static Result_COption_ClosureReasonZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_COption_ClosureReasonZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_COption_ClosureReasonZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_COption_ClosureReasonZDecodeErrorZ extends CommonBase { */ public Result_COption_ClosureReasonZDecodeErrorZ clone() { long ret = bindings.CResult_COption_ClosureReasonZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java index daf8f8e1..7c0fb42f 100644 --- a/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_EventZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_COption_EventZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { */ public static Result_COption_EventZDecodeErrorZ ok(Option_EventZ o) { long ret = bindings.CResult_COption_EventZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { */ public static Result_COption_EventZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_COption_EventZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_COption_EventZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_COption_EventZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_COption_EventZDecodeErrorZ extends CommonBase { */ public Result_COption_EventZDecodeErrorZ clone() { long ret = bindings.CResult_COption_EventZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java index bc311a11..3b028545 100644 --- a/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_MonitorEventZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { */ public static Result_COption_MonitorEventZDecodeErrorZ ok(Option_MonitorEventZ o) { long ret = bindings.CResult_COption_MonitorEventZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { */ public static Result_COption_MonitorEventZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_COption_MonitorEventZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_COption_MonitorEventZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_COption_MonitorEventZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_COption_MonitorEventZDecodeErrorZ extends CommonBase { */ public Result_COption_MonitorEventZDecodeErrorZ clone() { long ret = bindings.CResult_COption_MonitorEventZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java index e639a619..6fb8352d 100644 --- a/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_NetworkUpdateZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { */ public static Result_COption_NetworkUpdateZDecodeErrorZ ok(Option_NetworkUpdateZ o) { long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { */ public static Result_COption_NetworkUpdateZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_COption_NetworkUpdateZDecodeErrorZ extends CommonBase { */ public Result_COption_NetworkUpdateZDecodeErrorZ clone() { long ret = bindings.CResult_COption_NetworkUpdateZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java index 80f39b53..b11d655b 100644 --- a/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_COption_TypeZDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_COption_TypeZDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { */ public static Result_COption_TypeZDecodeErrorZ ok(Option_TypeZ o) { long ret = bindings.CResult_COption_TypeZDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { */ public static Result_COption_TypeZDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_COption_TypeZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_COption_TypeZDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_COption_TypeZDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_COption_TypeZDecodeErrorZ extends CommonBase { */ public Result_COption_TypeZDecodeErrorZ clone() { long ret = bindings.CResult_COption_TypeZDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.java b/src/main/java/org/ldk/structs/Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.java index 24f20b43..ccaefd7a 100644 --- a/src/main/java/org/ldk/structs/Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonBase { @@ -48,6 +49,7 @@ public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonB */ public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ok(TwoTuple_BlockHashChannelMonitorZ[] o) { long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o != null ? Arrays.stream(o).mapToLong(o_conv_35 -> o_conv_35 != null ? o_conv_35.ptr : 0).toArray() : null); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,6 +60,7 @@ public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonB */ public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ err(org.ldk.enums.IOError e) { long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -68,11 +71,13 @@ public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonB */ public boolean is_ok() { boolean ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -82,6 +87,7 @@ public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonB */ public Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ clone() { long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java b/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java index cc585451..f2f52afe 100644 --- a/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_CVec_CVec_u8ZZNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CVec_CVec_u8ZZNoneZ extends CommonBase { @@ -38,6 +39,7 @@ public class Result_CVec_CVec_u8ZZNoneZ extends CommonBase { */ public static Result_CVec_CVec_u8ZZNoneZ ok(byte[][] o) { long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_CVec_CVec_u8ZZNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_CVec_CVec_u8ZZNoneZ extends CommonBase { */ public Result_CVec_CVec_u8ZZNoneZ clone() { long ret = bindings.CResult_CVec_CVec_u8ZZNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CVec_SignatureZNoneZ.java b/src/main/java/org/ldk/structs/Result_CVec_SignatureZNoneZ.java index c5d7e856..3d044d44 100644 --- a/src/main/java/org/ldk/structs/Result_CVec_SignatureZNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_CVec_SignatureZNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CVec_SignatureZNoneZ extends CommonBase { @@ -38,6 +39,7 @@ public class Result_CVec_SignatureZNoneZ extends CommonBase { */ public static Result_CVec_SignatureZNoneZ ok(byte[][] o) { long ret = bindings.CResult_CVec_SignatureZNoneZ_ok(o != null ? Arrays.stream(o).map(o_conv_8 -> InternalUtils.check_arr_len(o_conv_8, 64)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_CVec_SignatureZNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_CVec_SignatureZNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CVec_SignatureZNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_CVec_SignatureZNoneZ extends CommonBase { */ public Result_CVec_SignatureZNoneZ clone() { long ret = bindings.CResult_CVec_SignatureZNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CVec_u8ZPeerHandleErrorZ.java b/src/main/java/org/ldk/structs/Result_CVec_u8ZPeerHandleErrorZ.java index b6368d74..30b6d256 100644 --- a/src/main/java/org/ldk/structs/Result_CVec_u8ZPeerHandleErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CVec_u8ZPeerHandleErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CVec_u8ZPeerHandleErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_CVec_u8ZPeerHandleErrorZ extends CommonBase { */ public static Result_CVec_u8ZPeerHandleErrorZ ok(byte[] o) { long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_CVec_u8ZPeerHandleErrorZ extends CommonBase { */ public static Result_CVec_u8ZPeerHandleErrorZ err(PeerHandleError e) { long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_CVec_u8ZPeerHandleErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_CVec_u8ZPeerHandleErrorZ extends CommonBase { */ public Result_CVec_u8ZPeerHandleErrorZ clone() { long ret = bindings.CResult_CVec_u8ZPeerHandleErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_u8ZPeerHandleErrorZ ret_hu_conv = Result_CVec_u8ZPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java index 00d8524c..67214ac5 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelAnnouncementDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_ChannelAnnouncementDecodeErrorZ ok(ChannelAnnouncement o) { long ret = bindings.CResult_ChannelAnnouncementDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_ChannelAnnouncementDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelAnnouncementDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelAnnouncementDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelAnnouncementDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelAnnouncementDecodeErrorZ extends CommonBase { */ public Result_ChannelAnnouncementDecodeErrorZ clone() { long ret = bindings.CResult_ChannelAnnouncementDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java index d7dd4896..c733958c 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelConfigDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelConfigDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelConfigDecodeErrorZ extends CommonBase { */ public static Result_ChannelConfigDecodeErrorZ ok(ChannelConfig o) { long ret = bindings.CResult_ChannelConfigDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelConfigDecodeErrorZ extends CommonBase { */ public static Result_ChannelConfigDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelConfigDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelConfigDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelConfigDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelConfigDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelConfigDecodeErrorZ extends CommonBase { */ public Result_ChannelConfigDecodeErrorZ clone() { long ret = bindings.CResult_ChannelConfigDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelConfigDecodeErrorZ ret_hu_conv = Result_ChannelConfigDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java index 01f1801e..263385cd 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelFeaturesDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { */ public static Result_ChannelFeaturesDecodeErrorZ ok(ChannelFeatures o) { long ret = bindings.CResult_ChannelFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { */ public static Result_ChannelFeaturesDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelFeaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,6 +69,7 @@ public class Result_ChannelFeaturesDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelFeaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java index 6ed6b099..0f797fa8 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelInfoDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelInfoDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelInfoDecodeErrorZ extends CommonBase { */ public static Result_ChannelInfoDecodeErrorZ ok(ChannelInfo o) { long ret = bindings.CResult_ChannelInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelInfoDecodeErrorZ extends CommonBase { */ public static Result_ChannelInfoDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelInfoDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelInfoDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelInfoDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelInfoDecodeErrorZ extends CommonBase { */ public Result_ChannelInfoDecodeErrorZ clone() { long ret = bindings.CResult_ChannelInfoDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelInfoDecodeErrorZ ret_hu_conv = Result_ChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java index 58d180a0..a5b53823 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelMonitorUpdateDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelMonitorUpdateDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelMonitorUpdateDecodeErrorZ extends CommonBase { */ public static Result_ChannelMonitorUpdateDecodeErrorZ ok(ChannelMonitorUpdate o) { long ret = bindings.CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelMonitorUpdateDecodeErrorZ extends CommonBase { */ public static Result_ChannelMonitorUpdateDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelMonitorUpdateDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelMonitorUpdateDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelMonitorUpdateDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelMonitorUpdateDecodeErrorZ extends CommonBase { */ public Result_ChannelMonitorUpdateDecodeErrorZ clone() { long ret = bindings.CResult_ChannelMonitorUpdateDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelMonitorUpdateDecodeErrorZ ret_hu_conv = Result_ChannelMonitorUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java index 29cb5a8d..cf517744 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelPublicKeysDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { */ public static Result_ChannelPublicKeysDecodeErrorZ ok(ChannelPublicKeys o) { long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { */ public static Result_ChannelPublicKeysDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelPublicKeysDecodeErrorZ extends CommonBase { */ public Result_ChannelPublicKeysDecodeErrorZ clone() { long ret = bindings.CResult_ChannelPublicKeysDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java index 6363cdd0..6be5de3b 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelReestablishDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelReestablishDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelReestablishDecodeErrorZ extends CommonBase { */ public static Result_ChannelReestablishDecodeErrorZ ok(ChannelReestablish o) { long ret = bindings.CResult_ChannelReestablishDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelReestablishDecodeErrorZ extends CommonBase { */ public static Result_ChannelReestablishDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelReestablishDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelReestablishDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelReestablishDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelReestablishDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelReestablishDecodeErrorZ extends CommonBase { */ public Result_ChannelReestablishDecodeErrorZ clone() { long ret = bindings.CResult_ChannelReestablishDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelReestablishDecodeErrorZ ret_hu_conv = Result_ChannelReestablishDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java index d88d316c..14b6a2a2 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelTransactionParametersDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase */ public static Result_ChannelTransactionParametersDecodeErrorZ ok(ChannelTransactionParameters o) { long ret = bindings.CResult_ChannelTransactionParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase */ public static Result_ChannelTransactionParametersDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelTransactionParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelTransactionParametersDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelTransactionParametersDecodeErrorZ extends CommonBase */ public Result_ChannelTransactionParametersDecodeErrorZ clone() { long ret = bindings.CResult_ChannelTransactionParametersDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java new file mode 100644 index 00000000..cf6b4c3e --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_ChannelTypeFeaturesDecodeErrorZ.java @@ -0,0 +1,76 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_ChannelTypeFeaturesDecodeErrorZ extends CommonBase { + private Result_ChannelTypeFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelTypeFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(ptr)) { + return new Result_ChannelTypeFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelTypeFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelTypeFeaturesDecodeErrorZ_OK extends Result_ChannelTypeFeaturesDecodeErrorZ { + public final ChannelTypeFeatures res; + private Result_ChannelTypeFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + long res = bindings.LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(ptr); + ChannelTypeFeatures res_hu_conv = null; if (res < 0 || res > 4096) { res_hu_conv = new ChannelTypeFeatures(null, res); } + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ChannelTypeFeaturesDecodeErrorZ_Err extends Result_ChannelTypeFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_ChannelTypeFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(ptr); + DecodeError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new DecodeError(null, err); } + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + */ + public static Result_ChannelTypeFeaturesDecodeErrorZ ok(ChannelTypeFeatures o) { + long ret = bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + */ + public static Result_ChannelTypeFeaturesDecodeErrorZ err(DecodeError e) { + long ret = bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java index e493a0f9..9d505d87 100644 --- a/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ChannelUpdateDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { */ public static Result_ChannelUpdateDecodeErrorZ ok(ChannelUpdate o) { long ret = bindings.CResult_ChannelUpdateDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelUpdateDecodeErrorZ ret_hu_conv = Result_ChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { */ public static Result_ChannelUpdateDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ChannelUpdateDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelUpdateDecodeErrorZ ret_hu_conv = Result_ChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ChannelUpdateDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ChannelUpdateDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ChannelUpdateDecodeErrorZ extends CommonBase { */ public Result_ChannelUpdateDecodeErrorZ clone() { long ret = bindings.CResult_ChannelUpdateDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelUpdateDecodeErrorZ ret_hu_conv = Result_ChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java index d86b25be..fa5ba349 100644 --- a/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ClosingSignedDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ClosingSignedDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ClosingSignedDecodeErrorZ extends CommonBase { */ public static Result_ClosingSignedDecodeErrorZ ok(ClosingSigned o) { long ret = bindings.CResult_ClosingSignedDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ClosingSignedDecodeErrorZ extends CommonBase { */ public static Result_ClosingSignedDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ClosingSignedDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ClosingSignedDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ClosingSignedDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ClosingSignedDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ClosingSignedDecodeErrorZ extends CommonBase { */ public Result_ClosingSignedDecodeErrorZ clone() { long ret = bindings.CResult_ClosingSignedDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java index 74ce2a58..c499bf99 100644 --- a/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ClosingSignedFeeRangeDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase { */ public static Result_ClosingSignedFeeRangeDecodeErrorZ ok(ClosingSignedFeeRange o) { long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase { */ public static Result_ClosingSignedFeeRangeDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ClosingSignedFeeRangeDecodeErrorZ extends CommonBase { */ public Result_ClosingSignedFeeRangeDecodeErrorZ clone() { long ret = bindings.CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ClosingSignedFeeRangeDecodeErrorZ ret_hu_conv = Result_ClosingSignedFeeRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java index b3a739d0..5ced389b 100644 --- a/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CommitmentSignedDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { */ public static Result_CommitmentSignedDecodeErrorZ ok(CommitmentSigned o) { long ret = bindings.CResult_CommitmentSignedDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { */ public static Result_CommitmentSignedDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_CommitmentSignedDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_CommitmentSignedDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CommitmentSignedDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_CommitmentSignedDecodeErrorZ extends CommonBase { */ public Result_CommitmentSignedDecodeErrorZ clone() { long ret = bindings.CResult_CommitmentSignedDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java index 4054c0f5..2ae1b772 100644 --- a/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CommitmentTransactionDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { */ public static Result_CommitmentTransactionDecodeErrorZ ok(CommitmentTransaction o) { long ret = bindings.CResult_CommitmentTransactionDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { */ public static Result_CommitmentTransactionDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_CommitmentTransactionDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_CommitmentTransactionDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CommitmentTransactionDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_CommitmentTransactionDecodeErrorZ extends CommonBase { */ public Result_CommitmentTransactionDecodeErrorZ clone() { long ret = bindings.CResult_CommitmentTransactionDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CommitmentTransactionDecodeErrorZ ret_hu_conv = Result_CommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java index f73e29ad..d0112606 100644 --- a/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_CounterpartyChannelTransactionParametersDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends */ public static Result_CounterpartyChannelTransactionParametersDecodeErrorZ ok(CounterpartyChannelTransactionParameters o) { long ret = bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_CounterpartyChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends */ public static Result_CounterpartyChannelTransactionParametersDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_CounterpartyChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends */ public boolean is_ok() { boolean ret = bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_CounterpartyChannelTransactionParametersDecodeErrorZ extends */ public Result_CounterpartyChannelTransactionParametersDecodeErrorZ clone() { long ret = bindings.CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_CounterpartyChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_CounterpartyChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java index 3c88dd5f..3cf13997 100644 --- a/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_DelayedPaymentOutputDescriptorDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_DelayedPaymentOutputDescriptorDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_DelayedPaymentOutputDescriptorDecodeErrorZ extends CommonBas */ public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ ok(DelayedPaymentOutputDescriptor o) { long ret = bindings.CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_DelayedPaymentOutputDescriptorDecodeErrorZ extends CommonBas */ public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_DelayedPaymentOutputDescriptorDecodeErrorZ extends CommonBas */ public boolean is_ok() { boolean ret = bindings.CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_DelayedPaymentOutputDescriptorDecodeErrorZ extends CommonBas */ public Result_DelayedPaymentOutputDescriptorDecodeErrorZ clone() { long ret = bindings.CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_DescriptionCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_DescriptionCreationErrorZ.java index 96fee8f1..644d38ba 100644 --- a/src/main/java/org/ldk/structs/Result_DescriptionCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_DescriptionCreationErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_DescriptionCreationErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_DescriptionCreationErrorZ extends CommonBase { */ public static Result_DescriptionCreationErrorZ ok(Description o) { long ret = bindings.CResult_DescriptionCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_DescriptionCreationErrorZ extends CommonBase { */ public static Result_DescriptionCreationErrorZ err(org.ldk.enums.CreationError e) { long ret = bindings.CResult_DescriptionCreationErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_DescriptionCreationErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_DescriptionCreationErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_DescriptionCreationErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_DescriptionCreationErrorZ extends CommonBase { */ public Result_DescriptionCreationErrorZ clone() { long ret = bindings.CResult_DescriptionCreationErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java index 7f055233..f4aee11c 100644 --- a/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_DirectionalChannelInfoDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { */ public static Result_DirectionalChannelInfoDecodeErrorZ ok(DirectionalChannelInfo o) { long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { */ public static Result_DirectionalChannelInfoDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_DirectionalChannelInfoDecodeErrorZ extends CommonBase { */ public Result_DirectionalChannelInfoDecodeErrorZ clone() { long ret = bindings.CResult_DirectionalChannelInfoDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_DirectionalChannelInfoDecodeErrorZ ret_hu_conv = Result_DirectionalChannelInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java index 4c88b27b..1e77aeed 100644 --- a/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ErrorMessageDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ErrorMessageDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ErrorMessageDecodeErrorZ extends CommonBase { */ public static Result_ErrorMessageDecodeErrorZ ok(ErrorMessage o) { long ret = bindings.CResult_ErrorMessageDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ErrorMessageDecodeErrorZ extends CommonBase { */ public static Result_ErrorMessageDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ErrorMessageDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ErrorMessageDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ErrorMessageDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ErrorMessageDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ErrorMessageDecodeErrorZ extends CommonBase { */ public Result_ErrorMessageDecodeErrorZ clone() { long ret = bindings.CResult_ErrorMessageDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ErrorMessageDecodeErrorZ ret_hu_conv = Result_ErrorMessageDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java index a3169a5e..9ad9a719 100644 --- a/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ExpiryTimeCreationErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ExpiryTimeCreationErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_ExpiryTimeCreationErrorZ extends CommonBase { */ public static Result_ExpiryTimeCreationErrorZ ok(ExpiryTime o) { long ret = bindings.CResult_ExpiryTimeCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_ExpiryTimeCreationErrorZ extends CommonBase { */ public static Result_ExpiryTimeCreationErrorZ err(org.ldk.enums.CreationError e) { long ret = bindings.CResult_ExpiryTimeCreationErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_ExpiryTimeCreationErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ExpiryTimeCreationErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ExpiryTimeCreationErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_ExpiryTimeCreationErrorZ extends CommonBase { */ public Result_ExpiryTimeCreationErrorZ clone() { long ret = bindings.CResult_ExpiryTimeCreationErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java index 83109a01..b709e1df 100644 --- a/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_FundingCreatedDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_FundingCreatedDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_FundingCreatedDecodeErrorZ extends CommonBase { */ public static Result_FundingCreatedDecodeErrorZ ok(FundingCreated o) { long ret = bindings.CResult_FundingCreatedDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_FundingCreatedDecodeErrorZ extends CommonBase { */ public static Result_FundingCreatedDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_FundingCreatedDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_FundingCreatedDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_FundingCreatedDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_FundingCreatedDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_FundingCreatedDecodeErrorZ extends CommonBase { */ public Result_FundingCreatedDecodeErrorZ clone() { long ret = bindings.CResult_FundingCreatedDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java index d53ec19c..83cc6905 100644 --- a/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_FundingLockedDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_FundingLockedDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_FundingLockedDecodeErrorZ extends CommonBase { */ public static Result_FundingLockedDecodeErrorZ ok(FundingLocked o) { long ret = bindings.CResult_FundingLockedDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingLockedDecodeErrorZ ret_hu_conv = Result_FundingLockedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_FundingLockedDecodeErrorZ extends CommonBase { */ public static Result_FundingLockedDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_FundingLockedDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingLockedDecodeErrorZ ret_hu_conv = Result_FundingLockedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_FundingLockedDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_FundingLockedDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_FundingLockedDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_FundingLockedDecodeErrorZ extends CommonBase { */ public Result_FundingLockedDecodeErrorZ clone() { long ret = bindings.CResult_FundingLockedDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingLockedDecodeErrorZ ret_hu_conv = Result_FundingLockedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java index 87ff66aa..eefd0427 100644 --- a/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_FundingSignedDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_FundingSignedDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_FundingSignedDecodeErrorZ extends CommonBase { */ public static Result_FundingSignedDecodeErrorZ ok(FundingSigned o) { long ret = bindings.CResult_FundingSignedDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_FundingSignedDecodeErrorZ extends CommonBase { */ public static Result_FundingSignedDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_FundingSignedDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_FundingSignedDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_FundingSignedDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_FundingSignedDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_FundingSignedDecodeErrorZ extends CommonBase { */ public Result_FundingSignedDecodeErrorZ clone() { long ret = bindings.CResult_FundingSignedDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java index bd2c4e86..4d9cfebe 100644 --- a/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_GossipTimestampFilterDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_GossipTimestampFilterDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_GossipTimestampFilterDecodeErrorZ extends CommonBase { */ public static Result_GossipTimestampFilterDecodeErrorZ ok(GossipTimestampFilter o) { long ret = bindings.CResult_GossipTimestampFilterDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_GossipTimestampFilterDecodeErrorZ extends CommonBase { */ public static Result_GossipTimestampFilterDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_GossipTimestampFilterDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_GossipTimestampFilterDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_GossipTimestampFilterDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_GossipTimestampFilterDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_GossipTimestampFilterDecodeErrorZ extends CommonBase { */ public Result_GossipTimestampFilterDecodeErrorZ clone() { long ret = bindings.CResult_GossipTimestampFilterDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java index 583d06fc..9e2b43ec 100644 --- a/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_HTLCOutputInCommitmentDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { */ public static Result_HTLCOutputInCommitmentDecodeErrorZ ok(HTLCOutputInCommitment o) { long ret = bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { */ public static Result_HTLCOutputInCommitmentDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_HTLCOutputInCommitmentDecodeErrorZ extends CommonBase { */ public Result_HTLCOutputInCommitmentDecodeErrorZ clone() { long ret = bindings.CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java index 500c0748..5deab780 100644 --- a/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_HTLCUpdateDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { */ public static Result_HTLCUpdateDecodeErrorZ ok(HTLCUpdate o) { long ret = bindings.CResult_HTLCUpdateDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { */ public static Result_HTLCUpdateDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_HTLCUpdateDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_HTLCUpdateDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_HTLCUpdateDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_HTLCUpdateDecodeErrorZ extends CommonBase { */ public Result_HTLCUpdateDecodeErrorZ clone() { long ret = bindings.CResult_HTLCUpdateDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_HTLCUpdateDecodeErrorZ ret_hu_conv = Result_HTLCUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java index 24829770..d7f149c8 100644 --- a/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_HolderCommitmentTransactionDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { */ public static Result_HolderCommitmentTransactionDecodeErrorZ ok(HolderCommitmentTransaction o) { long ret = bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { */ public static Result_HolderCommitmentTransactionDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_HolderCommitmentTransactionDecodeErrorZ extends CommonBase { */ public Result_HolderCommitmentTransactionDecodeErrorZ clone() { long ret = bindings.CResult_HolderCommitmentTransactionDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_HolderCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_HolderCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java index 7b54e4ab..390f3486 100644 --- a/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InMemorySignerDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InMemorySignerDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_InMemorySignerDecodeErrorZ extends CommonBase { */ public static Result_InMemorySignerDecodeErrorZ ok(InMemorySigner o) { long ret = bindings.CResult_InMemorySignerDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_InMemorySignerDecodeErrorZ extends CommonBase { */ public static Result_InMemorySignerDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_InMemorySignerDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_InMemorySignerDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InMemorySignerDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_InMemorySignerDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_InMemorySignerDecodeErrorZ extends CommonBase { */ public Result_InMemorySignerDecodeErrorZ clone() { long ret = bindings.CResult_InMemorySignerDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_InMemorySignerDecodeErrorZ ret_hu_conv = Result_InMemorySignerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java index b13f2a6a..1da75b0b 100644 --- a/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InitDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InitDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_InitDecodeErrorZ extends CommonBase { */ public static Result_InitDecodeErrorZ ok(Init o) { long ret = bindings.CResult_InitDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_InitDecodeErrorZ extends CommonBase { */ public static Result_InitDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_InitDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_InitDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InitDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_InitDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_InitDecodeErrorZ extends CommonBase { */ public Result_InitDecodeErrorZ clone() { long ret = bindings.CResult_InitDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_InitDecodeErrorZ ret_hu_conv = Result_InitDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java index ba1f003a..aa3c64c2 100644 --- a/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InitFeaturesDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InitFeaturesDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_InitFeaturesDecodeErrorZ extends CommonBase { */ public static Result_InitFeaturesDecodeErrorZ ok(InitFeatures o) { long ret = bindings.CResult_InitFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_InitFeaturesDecodeErrorZ extends CommonBase { */ public static Result_InitFeaturesDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_InitFeaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InitFeaturesDecodeErrorZ ret_hu_conv = Result_InitFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,6 +69,7 @@ public class Result_InitFeaturesDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InitFeaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java index 3a337bb6..90710096 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceFeaturesDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { */ public static Result_InvoiceFeaturesDecodeErrorZ ok(InvoiceFeatures o) { long ret = bindings.CResult_InvoiceFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { */ public static Result_InvoiceFeaturesDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_InvoiceFeaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceFeaturesDecodeErrorZ ret_hu_conv = Result_InvoiceFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,6 +69,7 @@ public class Result_InvoiceFeaturesDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InvoiceFeaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java b/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java index 85afc1b5..3670c021 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InvoiceNoneZ extends CommonBase { @@ -41,6 +42,7 @@ public class Result_InvoiceNoneZ extends CommonBase { */ public static Result_InvoiceNoneZ ok(Invoice o) { long ret = bindings.CResult_InvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_InvoiceNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InvoiceNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_InvoiceNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_InvoiceNoneZ extends CommonBase { */ public Result_InvoiceNoneZ clone() { long ret = bindings.CResult_InvoiceNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_InvoiceSemanticErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceSemanticErrorZ.java index cca24af0..7776d218 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceSemanticErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceSemanticErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InvoiceSemanticErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_InvoiceSemanticErrorZ extends CommonBase { */ public static Result_InvoiceSemanticErrorZ ok(Invoice o) { long ret = bindings.CResult_InvoiceSemanticErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_InvoiceSemanticErrorZ extends CommonBase { */ public static Result_InvoiceSemanticErrorZ err(org.ldk.enums.SemanticError e) { long ret = bindings.CResult_InvoiceSemanticErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_InvoiceSemanticErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InvoiceSemanticErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_InvoiceSemanticErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_InvoiceSemanticErrorZ extends CommonBase { */ public Result_InvoiceSemanticErrorZ clone() { long ret = bindings.CResult_InvoiceSemanticErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSemanticErrorZ ret_hu_conv = Result_InvoiceSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java index c61e1e4d..befbd547 100644 --- a/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_InvoiceSignOrCreationErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { */ public static Result_InvoiceSignOrCreationErrorZ ok(Invoice o) { long ret = bindings.CResult_InvoiceSignOrCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { */ public static Result_InvoiceSignOrCreationErrorZ err(SignOrCreationError e) { long ret = bindings.CResult_InvoiceSignOrCreationErrorZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_InvoiceSignOrCreationErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_InvoiceSignOrCreationErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_InvoiceSignOrCreationErrorZ extends CommonBase { */ public Result_InvoiceSignOrCreationErrorZ clone() { long ret = bindings.CResult_InvoiceSignOrCreationErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java b/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java index 43e36b85..50d8b037 100644 --- a/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_LockedChannelMonitorNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_LockedChannelMonitorNoneZ extends CommonBase { @@ -41,6 +42,7 @@ public class Result_LockedChannelMonitorNoneZ extends CommonBase { */ public static Result_LockedChannelMonitorNoneZ ok(LockedChannelMonitor o) { long ret = bindings.CResult_LockedChannelMonitorNoneZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_LockedChannelMonitorNoneZ ret_hu_conv = Result_LockedChannelMonitorNoneZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(o); @@ -70,6 +72,7 @@ public class Result_LockedChannelMonitorNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_LockedChannelMonitorNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java index 17eafe88..f0c07594 100644 --- a/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetAddressDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NetAddressDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { */ public static Result_NetAddressDecodeErrorZ ok(NetAddress o) { long ret = bindings.CResult_NetAddressDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NetAddressDecodeErrorZ ret_hu_conv = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { */ public static Result_NetAddressDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NetAddressDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NetAddressDecodeErrorZ ret_hu_conv = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NetAddressDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NetAddressDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_NetAddressDecodeErrorZ extends CommonBase { */ public Result_NetAddressDecodeErrorZ clone() { long ret = bindings.CResult_NetAddressDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NetAddressDecodeErrorZ ret_hu_conv = Result_NetAddressDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java index 57286ccc..5ad2ab0b 100644 --- a/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NetworkGraphDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NetworkGraphDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { */ public static Result_NetworkGraphDecodeErrorZ ok(NetworkGraph o) { long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { */ public static Result_NetworkGraphDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NetworkGraphDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NetworkGraphDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NetworkGraphDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_NetworkGraphDecodeErrorZ extends CommonBase { */ public Result_NetworkGraphDecodeErrorZ clone() { long ret = bindings.CResult_NetworkGraphDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java index 20cae360..9264d87f 100644 --- a/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeAnnouncementDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_NodeAnnouncementDecodeErrorZ ok(NodeAnnouncement o) { long ret = bindings.CResult_NodeAnnouncementDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_NodeAnnouncementDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NodeAnnouncementDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NodeAnnouncementDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NodeAnnouncementDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_NodeAnnouncementDecodeErrorZ extends CommonBase { */ public Result_NodeAnnouncementDecodeErrorZ clone() { long ret = bindings.CResult_NodeAnnouncementDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java index 877b7f19..3e1ddaf2 100644 --- a/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeAnnouncementInfoDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NodeAnnouncementInfoDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NodeAnnouncementInfoDecodeErrorZ extends CommonBase { */ public static Result_NodeAnnouncementInfoDecodeErrorZ ok(NodeAnnouncementInfo o) { long ret = bindings.CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NodeAnnouncementInfoDecodeErrorZ extends CommonBase { */ public static Result_NodeAnnouncementInfoDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NodeAnnouncementInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_NodeAnnouncementInfoDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NodeAnnouncementInfoDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_NodeAnnouncementInfoDecodeErrorZ extends CommonBase { */ public Result_NodeAnnouncementInfoDecodeErrorZ clone() { long ret = bindings.CResult_NodeAnnouncementInfoDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeAnnouncementInfoDecodeErrorZ ret_hu_conv = Result_NodeAnnouncementInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java index f121e124..a3d14e76 100644 --- a/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeFeaturesDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { */ public static Result_NodeFeaturesDecodeErrorZ ok(NodeFeatures o) { long ret = bindings.CResult_NodeFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { */ public static Result_NodeFeaturesDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NodeFeaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeFeaturesDecodeErrorZ ret_hu_conv = Result_NodeFeaturesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,6 +69,7 @@ public class Result_NodeFeaturesDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NodeFeaturesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java index ab1c2843..dd1c0cd4 100644 --- a/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeIdDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NodeIdDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NodeIdDecodeErrorZ extends CommonBase { */ public static Result_NodeIdDecodeErrorZ ok(NodeId o) { long ret = bindings.CResult_NodeIdDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NodeIdDecodeErrorZ extends CommonBase { */ public static Result_NodeIdDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NodeIdDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_NodeIdDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NodeIdDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NodeIdDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_NodeIdDecodeErrorZ extends CommonBase { */ public Result_NodeIdDecodeErrorZ clone() { long ret = bindings.CResult_NodeIdDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeIdDecodeErrorZ ret_hu_conv = Result_NodeIdDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java index b8330673..65d716b1 100644 --- a/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NodeInfoDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NodeInfoDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_NodeInfoDecodeErrorZ extends CommonBase { */ public static Result_NodeInfoDecodeErrorZ ok(NodeInfo o) { long ret = bindings.CResult_NodeInfoDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_NodeInfoDecodeErrorZ extends CommonBase { */ public static Result_NodeInfoDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_NodeInfoDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_NodeInfoDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NodeInfoDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NodeInfoDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_NodeInfoDecodeErrorZ extends CommonBase { */ public Result_NodeInfoDecodeErrorZ clone() { long ret = bindings.CResult_NodeInfoDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NodeInfoDecodeErrorZ ret_hu_conv = Result_NodeInfoDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java index 64977a26..11a4ab92 100644 --- a/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneAPIErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NoneAPIErrorZ extends CommonBase { @@ -51,6 +52,7 @@ public class Result_NoneAPIErrorZ extends CommonBase { */ public static Result_NoneAPIErrorZ err(APIError e) { long ret = bindings.CResult_NoneAPIErrorZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_NoneAPIErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NoneAPIErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NoneAPIErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_NoneAPIErrorZ extends CommonBase { */ public Result_NoneAPIErrorZ clone() { long ret = bindings.CResult_NoneAPIErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneAPIErrorZ ret_hu_conv = Result_NoneAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NoneChannelMonitorUpdateErrZ.java b/src/main/java/org/ldk/structs/Result_NoneChannelMonitorUpdateErrZ.java index d8bfde24..06ed8aee 100644 --- a/src/main/java/org/ldk/structs/Result_NoneChannelMonitorUpdateErrZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneChannelMonitorUpdateErrZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NoneChannelMonitorUpdateErrZ extends CommonBase { @@ -48,6 +49,7 @@ public class Result_NoneChannelMonitorUpdateErrZ extends CommonBase { */ public static Result_NoneChannelMonitorUpdateErrZ err(org.ldk.enums.ChannelMonitorUpdateErr e) { long ret = bindings.CResult_NoneChannelMonitorUpdateErrZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_NoneChannelMonitorUpdateErrZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NoneChannelMonitorUpdateErrZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NoneChannelMonitorUpdateErrZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_NoneChannelMonitorUpdateErrZ extends CommonBase { */ public Result_NoneChannelMonitorUpdateErrZ clone() { long ret = bindings.CResult_NoneChannelMonitorUpdateErrZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NoneErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneErrorZ.java index a2fc3b4b..bc69c52a 100644 --- a/src/main/java/org/ldk/structs/Result_NoneErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NoneErrorZ extends CommonBase { @@ -48,6 +49,7 @@ public class Result_NoneErrorZ extends CommonBase { */ public static Result_NoneErrorZ err(org.ldk.enums.IOError e) { long ret = bindings.CResult_NoneErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_NoneErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NoneErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NoneErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_NoneErrorZ extends CommonBase { */ public Result_NoneErrorZ clone() { long ret = bindings.CResult_NoneErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NoneLightningErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneLightningErrorZ.java index 0e8624d8..652fa3d1 100644 --- a/src/main/java/org/ldk/structs/Result_NoneLightningErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneLightningErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NoneLightningErrorZ extends CommonBase { @@ -51,6 +52,7 @@ public class Result_NoneLightningErrorZ extends CommonBase { */ public static Result_NoneLightningErrorZ err(LightningError e) { long ret = bindings.CResult_NoneLightningErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_NoneLightningErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NoneLightningErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NoneLightningErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_NoneLightningErrorZ extends CommonBase { */ public Result_NoneLightningErrorZ clone() { long ret = bindings.CResult_NoneLightningErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NoneMonitorUpdateErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneMonitorUpdateErrorZ.java deleted file mode 100644 index afc833ae..00000000 --- a/src/main/java/org/ldk/structs/Result_NoneMonitorUpdateErrorZ.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.ldk.structs; - -import org.ldk.impl.bindings; -import org.ldk.enums.*; -import org.ldk.util.*; -import java.util.Arrays; -import javax.annotation.Nullable; - -public class Result_NoneMonitorUpdateErrorZ extends CommonBase { - private Result_NoneMonitorUpdateErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_NoneMonitorUpdateErrorZ_free(ptr); } super.finalize(); - } - - static Result_NoneMonitorUpdateErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_NoneMonitorUpdateErrorZ_is_ok(ptr)) { - return new Result_NoneMonitorUpdateErrorZ_OK(null, ptr); - } else { - return new Result_NoneMonitorUpdateErrorZ_Err(null, ptr); - } - } - public static final class Result_NoneMonitorUpdateErrorZ_OK extends Result_NoneMonitorUpdateErrorZ { - private Result_NoneMonitorUpdateErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - public static final class Result_NoneMonitorUpdateErrorZ_Err extends Result_NoneMonitorUpdateErrorZ { - public final MonitorUpdateError err; - private Result_NoneMonitorUpdateErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - long err = bindings.LDKCResult_NoneMonitorUpdateErrorZ_get_err(ptr); - MonitorUpdateError err_hu_conv = null; if (err < 0 || err > 4096) { err_hu_conv = new MonitorUpdateError(null, err); } - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - /** - * Creates a new CResult_NoneMonitorUpdateErrorZ in the success state. - */ - public static Result_NoneMonitorUpdateErrorZ ok() { - long ret = bindings.CResult_NoneMonitorUpdateErrorZ_ok(); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Creates a new CResult_NoneMonitorUpdateErrorZ in the error state. - */ - public static Result_NoneMonitorUpdateErrorZ err(MonitorUpdateError e) { - long ret = bindings.CResult_NoneMonitorUpdateErrorZ_err(e == null ? 0 : e.ptr & ~1); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - /** - * Checks if the given object is currently in the success state - */ - public boolean is_ok() { - boolean ret = bindings.CResult_NoneMonitorUpdateErrorZ_is_ok(this.ptr); - return ret; - } - - long clone_ptr() { - long ret = bindings.CResult_NoneMonitorUpdateErrorZ_clone_ptr(this.ptr); - return ret; - } - - /** - * Creates a new CResult_NoneMonitorUpdateErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ - public Result_NoneMonitorUpdateErrorZ clone() { - long ret = bindings.CResult_NoneMonitorUpdateErrorZ_clone(this.ptr); - if (ret >= 0 && ret <= 4096) { return null; } - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/src/main/java/org/ldk/structs/Result_NoneNoneZ.java b/src/main/java/org/ldk/structs/Result_NoneNoneZ.java index 3251bb95..937001df 100644 --- a/src/main/java/org/ldk/structs/Result_NoneNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NoneNoneZ extends CommonBase { @@ -56,11 +57,13 @@ public class Result_NoneNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NoneNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NoneNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,6 +73,7 @@ public class Result_NoneNoneZ extends CommonBase { */ public Result_NoneNoneZ clone() { long ret = bindings.CResult_NoneNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java index 40587621..688a9974 100644 --- a/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_NonePaymentSendFailureZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NonePaymentSendFailureZ extends CommonBase { @@ -51,6 +52,7 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { */ public static Result_NonePaymentSendFailureZ err(PaymentSendFailure e) { long ret = bindings.CResult_NonePaymentSendFailureZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NonePaymentSendFailureZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NonePaymentSendFailureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_NonePaymentSendFailureZ extends CommonBase { */ public Result_NonePaymentSendFailureZ clone() { long ret = bindings.CResult_NonePaymentSendFailureZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NonePeerHandleErrorZ.java b/src/main/java/org/ldk/structs/Result_NonePeerHandleErrorZ.java index 643cd7f5..28edb700 100644 --- a/src/main/java/org/ldk/structs/Result_NonePeerHandleErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NonePeerHandleErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NonePeerHandleErrorZ extends CommonBase { @@ -51,6 +52,7 @@ public class Result_NonePeerHandleErrorZ extends CommonBase { */ public static Result_NonePeerHandleErrorZ err(PeerHandleError e) { long ret = bindings.CResult_NonePeerHandleErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePeerHandleErrorZ ret_hu_conv = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_NonePeerHandleErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NonePeerHandleErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NonePeerHandleErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_NonePeerHandleErrorZ extends CommonBase { */ public Result_NonePeerHandleErrorZ clone() { long ret = bindings.CResult_NonePeerHandleErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NonePeerHandleErrorZ ret_hu_conv = Result_NonePeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_NoneSemanticErrorZ.java b/src/main/java/org/ldk/structs/Result_NoneSemanticErrorZ.java index 3d95a8b5..902447c3 100644 --- a/src/main/java/org/ldk/structs/Result_NoneSemanticErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_NoneSemanticErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_NoneSemanticErrorZ extends CommonBase { @@ -48,6 +49,7 @@ public class Result_NoneSemanticErrorZ extends CommonBase { */ public static Result_NoneSemanticErrorZ err(org.ldk.enums.SemanticError e) { long ret = bindings.CResult_NoneSemanticErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_NoneSemanticErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_NoneSemanticErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_NoneSemanticErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_NoneSemanticErrorZ extends CommonBase { */ public Result_NoneSemanticErrorZ clone() { long ret = bindings.CResult_NoneSemanticErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneSemanticErrorZ ret_hu_conv = Result_NoneSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java index 5586590f..4a993909 100644 --- a/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_OpenChannelDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_OpenChannelDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_OpenChannelDecodeErrorZ extends CommonBase { */ public static Result_OpenChannelDecodeErrorZ ok(OpenChannel o) { long ret = bindings.CResult_OpenChannelDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_OpenChannelDecodeErrorZ extends CommonBase { */ public static Result_OpenChannelDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_OpenChannelDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_OpenChannelDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_OpenChannelDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_OpenChannelDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_OpenChannelDecodeErrorZ extends CommonBase { */ public Result_OpenChannelDecodeErrorZ clone() { long ret = bindings.CResult_OpenChannelDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java index 9ec86cd3..e193b4a8 100644 --- a/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_OutPointDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_OutPointDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_OutPointDecodeErrorZ extends CommonBase { */ public static Result_OutPointDecodeErrorZ ok(OutPoint o) { long ret = bindings.CResult_OutPointDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_OutPointDecodeErrorZ extends CommonBase { */ public static Result_OutPointDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_OutPointDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_OutPointDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_OutPointDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_OutPointDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_OutPointDecodeErrorZ extends CommonBase { */ public Result_OutPointDecodeErrorZ clone() { long ret = bindings.CResult_OutPointDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_OutPointDecodeErrorZ ret_hu_conv = Result_OutPointDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.java index 8104e4c6..030b0c2f 100644 --- a/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PayeeDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PayeeDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_PayeeDecodeErrorZ extends CommonBase { */ public static Result_PayeeDecodeErrorZ ok(Payee o) { long ret = bindings.CResult_PayeeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_PayeeDecodeErrorZ extends CommonBase { */ public static Result_PayeeDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_PayeeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_PayeeDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PayeeDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PayeeDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_PayeeDecodeErrorZ extends CommonBase { */ public Result_PayeeDecodeErrorZ clone() { long ret = bindings.CResult_PayeeDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeeDecodeErrorZ ret_hu_conv = Result_PayeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PayeePubKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_PayeePubKeyErrorZ.java index 91ee0fcb..13dd5d68 100644 --- a/src/main/java/org/ldk/structs/Result_PayeePubKeyErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PayeePubKeyErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PayeePubKeyErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_PayeePubKeyErrorZ extends CommonBase { */ public static Result_PayeePubKeyErrorZ ok(PayeePubKey o) { long ret = bindings.CResult_PayeePubKeyErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_PayeePubKeyErrorZ extends CommonBase { */ public static Result_PayeePubKeyErrorZ err(org.ldk.enums.Secp256k1Error e) { long ret = bindings.CResult_PayeePubKeyErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_PayeePubKeyErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PayeePubKeyErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PayeePubKeyErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_PayeePubKeyErrorZ extends CommonBase { */ public Result_PayeePubKeyErrorZ clone() { long ret = bindings.CResult_PayeePubKeyErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java index 129508d3..173f7618 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PaymentIdPaymentErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_PaymentIdPaymentErrorZ extends CommonBase { */ public static Result_PaymentIdPaymentErrorZ ok(byte[] o) { long ret = bindings.CResult_PaymentIdPaymentErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_PaymentIdPaymentErrorZ extends CommonBase { */ public static Result_PaymentIdPaymentErrorZ err(PaymentError e) { long ret = bindings.CResult_PaymentIdPaymentErrorZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_PaymentIdPaymentErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PaymentIdPaymentErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PaymentIdPaymentErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_PaymentIdPaymentErrorZ extends CommonBase { */ public Result_PaymentIdPaymentErrorZ clone() { long ret = bindings.CResult_PaymentIdPaymentErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java index eb0e9267..a7063f7f 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentIdPaymentSendFailureZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { */ public static Result_PaymentIdPaymentSendFailureZ ok(byte[] o) { long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { */ public static Result_PaymentIdPaymentSendFailureZ err(PaymentSendFailure e) { long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PaymentIdPaymentSendFailureZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_PaymentIdPaymentSendFailureZ extends CommonBase { */ public Result_PaymentIdPaymentSendFailureZ clone() { long ret = bindings.CResult_PaymentIdPaymentSendFailureZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java new file mode 100644 index 00000000..fed35b2f --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PaymentPreimageAPIErrorZ.java @@ -0,0 +1,91 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_PaymentPreimageAPIErrorZ extends CommonBase { + private Result_PaymentPreimageAPIErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentPreimageAPIErrorZ_free(ptr); } super.finalize(); + } + + static Result_PaymentPreimageAPIErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_PaymentPreimageAPIErrorZ_is_ok(ptr)) { + return new Result_PaymentPreimageAPIErrorZ_OK(null, ptr); + } else { + return new Result_PaymentPreimageAPIErrorZ_Err(null, ptr); + } + } + public static final class Result_PaymentPreimageAPIErrorZ_OK extends Result_PaymentPreimageAPIErrorZ { + public final byte[] res; + private Result_PaymentPreimageAPIErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_PaymentPreimageAPIErrorZ_get_ok(ptr); + } + } + + public static final class Result_PaymentPreimageAPIErrorZ_Err extends Result_PaymentPreimageAPIErrorZ { + public final APIError err; + private Result_PaymentPreimageAPIErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + long err = bindings.LDKCResult_PaymentPreimageAPIErrorZ_get_err(ptr); + APIError err_hu_conv = APIError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + /** + * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. + */ + public static Result_PaymentPreimageAPIErrorZ ok(byte[] o) { + long ret = bindings.CResult_PaymentPreimageAPIErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. + */ + public static Result_PaymentPreimageAPIErrorZ err(APIError e) { + long ret = bindings.CResult_PaymentPreimageAPIErrorZ_err(e.ptr); + Reference.reachabilityFence(e); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_PaymentPreimageAPIErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_PaymentPreimageAPIErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PaymentPreimageAPIErrorZ clone() { + long ret = bindings.CResult_PaymentPreimageAPIErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java b/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java index 0cd424f6..91760b27 100644 --- a/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PaymentSecretAPIErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PaymentSecretAPIErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_PaymentSecretAPIErrorZ extends CommonBase { */ public static Result_PaymentSecretAPIErrorZ ok(byte[] o) { long ret = bindings.CResult_PaymentSecretAPIErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_PaymentSecretAPIErrorZ extends CommonBase { */ public static Result_PaymentSecretAPIErrorZ err(APIError e) { long ret = bindings.CResult_PaymentSecretAPIErrorZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_PaymentSecretAPIErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PaymentSecretAPIErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PaymentSecretAPIErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_PaymentSecretAPIErrorZ extends CommonBase { */ public Result_PaymentSecretAPIErrorZ clone() { long ret = bindings.CResult_PaymentSecretAPIErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PaymentSecretNoneZ.java b/src/main/java/org/ldk/structs/Result_PaymentSecretNoneZ.java new file mode 100644 index 00000000..7124a03c --- /dev/null +++ b/src/main/java/org/ldk/structs/Result_PaymentSecretNoneZ.java @@ -0,0 +1,85 @@ +package org.ldk.structs; + +import org.ldk.impl.bindings; +import org.ldk.enums.*; +import org.ldk.util.*; +import java.util.Arrays; +import java.lang.ref.Reference; +import javax.annotation.Nullable; + +public class Result_PaymentSecretNoneZ extends CommonBase { + private Result_PaymentSecretNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentSecretNoneZ_free(ptr); } super.finalize(); + } + + static Result_PaymentSecretNoneZ constr_from_ptr(long ptr) { + if (bindings.CResult_PaymentSecretNoneZ_is_ok(ptr)) { + return new Result_PaymentSecretNoneZ_OK(null, ptr); + } else { + return new Result_PaymentSecretNoneZ_Err(null, ptr); + } + } + public static final class Result_PaymentSecretNoneZ_OK extends Result_PaymentSecretNoneZ { + public final byte[] res; + private Result_PaymentSecretNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_PaymentSecretNoneZ_get_ok(ptr); + } + } + + public static final class Result_PaymentSecretNoneZ_Err extends Result_PaymentSecretNoneZ { + private Result_PaymentSecretNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + /** + * Creates a new CResult_PaymentSecretNoneZ in the success state. + */ + public static Result_PaymentSecretNoneZ ok(byte[] o) { + long ret = bindings.CResult_PaymentSecretNoneZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Creates a new CResult_PaymentSecretNoneZ in the error state. + */ + public static Result_PaymentSecretNoneZ err() { + long ret = bindings.CResult_PaymentSecretNoneZ_err(); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + /** + * Checks if the given object is currently in the success state + */ + public boolean is_ok() { + boolean ret = bindings.CResult_PaymentSecretNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + long clone_ptr() { + long ret = bindings.CResult_PaymentSecretNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ + public Result_PaymentSecretNoneZ clone() { + long ret = bindings.CResult_PaymentSecretNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); + if (ret >= 0 && ret <= 4096) { return null; } + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java index 52aa0f46..712489aa 100644 --- a/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PingDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PingDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_PingDecodeErrorZ extends CommonBase { */ public static Result_PingDecodeErrorZ ok(Ping o) { long ret = bindings.CResult_PingDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_PingDecodeErrorZ extends CommonBase { */ public static Result_PingDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_PingDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_PingDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PingDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PingDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_PingDecodeErrorZ extends CommonBase { */ public Result_PingDecodeErrorZ clone() { long ret = bindings.CResult_PingDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java index 9953acb9..61a6ce92 100644 --- a/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PongDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PongDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_PongDecodeErrorZ extends CommonBase { */ public static Result_PongDecodeErrorZ ok(Pong o) { long ret = bindings.CResult_PongDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_PongDecodeErrorZ extends CommonBase { */ public static Result_PongDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_PongDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_PongDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PongDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PongDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_PongDecodeErrorZ extends CommonBase { */ public Result_PongDecodeErrorZ clone() { long ret = bindings.CResult_PongDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PongDecodeErrorZ ret_hu_conv = Result_PongDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PositiveTimestampCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_PositiveTimestampCreationErrorZ.java index f4648168..f138e542 100644 --- a/src/main/java/org/ldk/structs/Result_PositiveTimestampCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PositiveTimestampCreationErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PositiveTimestampCreationErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_PositiveTimestampCreationErrorZ extends CommonBase { */ public static Result_PositiveTimestampCreationErrorZ ok(PositiveTimestamp o) { long ret = bindings.CResult_PositiveTimestampCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_PositiveTimestampCreationErrorZ extends CommonBase { */ public static Result_PositiveTimestampCreationErrorZ err(org.ldk.enums.CreationError e) { long ret = bindings.CResult_PositiveTimestampCreationErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_PositiveTimestampCreationErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PositiveTimestampCreationErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PositiveTimestampCreationErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_PositiveTimestampCreationErrorZ extends CommonBase { */ public Result_PositiveTimestampCreationErrorZ clone() { long ret = bindings.CResult_PositiveTimestampCreationErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PositiveTimestampCreationErrorZ ret_hu_conv = Result_PositiveTimestampCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java b/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java index a3e25fc0..63aa0abe 100644 --- a/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PrivateRouteCreationErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PrivateRouteCreationErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_PrivateRouteCreationErrorZ extends CommonBase { */ public static Result_PrivateRouteCreationErrorZ ok(PrivateRoute o) { long ret = bindings.CResult_PrivateRouteCreationErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_PrivateRouteCreationErrorZ extends CommonBase { */ public static Result_PrivateRouteCreationErrorZ err(org.ldk.enums.CreationError e) { long ret = bindings.CResult_PrivateRouteCreationErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_PrivateRouteCreationErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PrivateRouteCreationErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PrivateRouteCreationErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_PrivateRouteCreationErrorZ extends CommonBase { */ public Result_PrivateRouteCreationErrorZ clone() { long ret = bindings.CResult_PrivateRouteCreationErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java index 050a9e4e..857affa8 100644 --- a/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_PublicKeyErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_PublicKeyErrorZ extends CommonBase { @@ -40,6 +41,7 @@ public class Result_PublicKeyErrorZ extends CommonBase { */ public static Result_PublicKeyErrorZ ok(byte[] o) { long ret = bindings.CResult_PublicKeyErrorZ_ok(InternalUtils.check_arr_len(o, 33)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -50,6 +52,7 @@ public class Result_PublicKeyErrorZ extends CommonBase { */ public static Result_PublicKeyErrorZ err(org.ldk.enums.Secp256k1Error e) { long ret = bindings.CResult_PublicKeyErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -60,11 +63,13 @@ public class Result_PublicKeyErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_PublicKeyErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_PublicKeyErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -74,6 +79,7 @@ public class Result_PublicKeyErrorZ extends CommonBase { */ public Result_PublicKeyErrorZ clone() { long ret = bindings.CResult_PublicKeyErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java index 3e33eec2..1e0690f7 100644 --- a/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_QueryChannelRangeDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_QueryChannelRangeDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_QueryChannelRangeDecodeErrorZ extends CommonBase { */ public static Result_QueryChannelRangeDecodeErrorZ ok(QueryChannelRange o) { long ret = bindings.CResult_QueryChannelRangeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_QueryChannelRangeDecodeErrorZ extends CommonBase { */ public static Result_QueryChannelRangeDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_QueryChannelRangeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_QueryChannelRangeDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_QueryChannelRangeDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_QueryChannelRangeDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_QueryChannelRangeDecodeErrorZ extends CommonBase { */ public Result_QueryChannelRangeDecodeErrorZ clone() { long ret = bindings.CResult_QueryChannelRangeDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java index 73c3b007..7628876f 100644 --- a/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_QueryShortChannelIdsDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_QueryShortChannelIdsDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_QueryShortChannelIdsDecodeErrorZ extends CommonBase { */ public static Result_QueryShortChannelIdsDecodeErrorZ ok(QueryShortChannelIds o) { long ret = bindings.CResult_QueryShortChannelIdsDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_QueryShortChannelIdsDecodeErrorZ extends CommonBase { */ public static Result_QueryShortChannelIdsDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_QueryShortChannelIdsDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_QueryShortChannelIdsDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_QueryShortChannelIdsDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_QueryShortChannelIdsDecodeErrorZ extends CommonBase { */ public Result_QueryShortChannelIdsDecodeErrorZ clone() { long ret = bindings.CResult_QueryShortChannelIdsDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_QueryShortChannelIdsDecodeErrorZ ret_hu_conv = Result_QueryShortChannelIdsDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RecoverableSignatureNoneZ.java b/src/main/java/org/ldk/structs/Result_RecoverableSignatureNoneZ.java index 6f722b78..9d8da489 100644 --- a/src/main/java/org/ldk/structs/Result_RecoverableSignatureNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_RecoverableSignatureNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RecoverableSignatureNoneZ extends CommonBase { @@ -38,6 +39,7 @@ public class Result_RecoverableSignatureNoneZ extends CommonBase { */ public static Result_RecoverableSignatureNoneZ ok(byte[] arg) { long ret = bindings.CResult_RecoverableSignatureNoneZ_ok(InternalUtils.check_arr_len(arg, 68)); + Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; } Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_RecoverableSignatureNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RecoverableSignatureNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RecoverableSignatureNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_RecoverableSignatureNoneZ extends CommonBase { */ public Result_RecoverableSignatureNoneZ clone() { long ret = bindings.CResult_RecoverableSignatureNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java index e0a5bcbc..549cb83e 100644 --- a/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ReplyChannelRangeDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ReplyChannelRangeDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ReplyChannelRangeDecodeErrorZ extends CommonBase { */ public static Result_ReplyChannelRangeDecodeErrorZ ok(ReplyChannelRange o) { long ret = bindings.CResult_ReplyChannelRangeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ReplyChannelRangeDecodeErrorZ extends CommonBase { */ public static Result_ReplyChannelRangeDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ReplyChannelRangeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ReplyChannelRangeDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ReplyChannelRangeDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ReplyChannelRangeDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ReplyChannelRangeDecodeErrorZ extends CommonBase { */ public Result_ReplyChannelRangeDecodeErrorZ clone() { long ret = bindings.CResult_ReplyChannelRangeDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyChannelRangeDecodeErrorZ ret_hu_conv = Result_ReplyChannelRangeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java index 6aaa8a86..983ca01e 100644 --- a/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ReplyShortChannelIdsEndDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ReplyShortChannelIdsEndDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ReplyShortChannelIdsEndDecodeErrorZ extends CommonBase { */ public static Result_ReplyShortChannelIdsEndDecodeErrorZ ok(ReplyShortChannelIdsEnd o) { long ret = bindings.CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ReplyShortChannelIdsEndDecodeErrorZ extends CommonBase { */ public static Result_ReplyShortChannelIdsEndDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ReplyShortChannelIdsEndDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ReplyShortChannelIdsEndDecodeErrorZ extends CommonBase { */ public Result_ReplyShortChannelIdsEndDecodeErrorZ clone() { long ret = bindings.CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java index c165de27..fd4ce48a 100644 --- a/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RevokeAndACKDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { */ public static Result_RevokeAndACKDecodeErrorZ ok(RevokeAndACK o) { long ret = bindings.CResult_RevokeAndACKDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { */ public static Result_RevokeAndACKDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RevokeAndACKDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RevokeAndACKDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RevokeAndACKDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RevokeAndACKDecodeErrorZ extends CommonBase { */ public Result_RevokeAndACKDecodeErrorZ clone() { long ret = bindings.CResult_RevokeAndACKDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java index d78650fb..8641517e 100644 --- a/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RouteDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RouteDecodeErrorZ extends CommonBase { */ public static Result_RouteDecodeErrorZ ok(Route o) { long ret = bindings.CResult_RouteDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RouteDecodeErrorZ extends CommonBase { */ public static Result_RouteDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RouteDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RouteDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RouteDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RouteDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RouteDecodeErrorZ extends CommonBase { */ public Result_RouteDecodeErrorZ clone() { long ret = bindings.CResult_RouteDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java index 6c037eca..76c03355 100644 --- a/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteHintDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RouteHintDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RouteHintDecodeErrorZ extends CommonBase { */ public static Result_RouteHintDecodeErrorZ ok(RouteHint o) { long ret = bindings.CResult_RouteHintDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintDecodeErrorZ ret_hu_conv = Result_RouteHintDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RouteHintDecodeErrorZ extends CommonBase { */ public static Result_RouteHintDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RouteHintDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintDecodeErrorZ ret_hu_conv = Result_RouteHintDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RouteHintDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RouteHintDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RouteHintDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RouteHintDecodeErrorZ extends CommonBase { */ public Result_RouteHintDecodeErrorZ clone() { long ret = bindings.CResult_RouteHintDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintDecodeErrorZ ret_hu_conv = Result_RouteHintDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java index bb1179fd..e9121509 100644 --- a/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteHintHopDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RouteHintHopDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RouteHintHopDecodeErrorZ extends CommonBase { */ public static Result_RouteHintHopDecodeErrorZ ok(RouteHintHop o) { long ret = bindings.CResult_RouteHintHopDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RouteHintHopDecodeErrorZ extends CommonBase { */ public static Result_RouteHintHopDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RouteHintHopDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RouteHintHopDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RouteHintHopDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RouteHintHopDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RouteHintHopDecodeErrorZ extends CommonBase { */ public Result_RouteHintHopDecodeErrorZ clone() { long ret = bindings.CResult_RouteHintHopDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java index 5abe5f5f..1cea8395 100644 --- a/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteHopDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RouteHopDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RouteHopDecodeErrorZ extends CommonBase { */ public static Result_RouteHopDecodeErrorZ ok(RouteHop o) { long ret = bindings.CResult_RouteHopDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RouteHopDecodeErrorZ extends CommonBase { */ public static Result_RouteHopDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RouteHopDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RouteHopDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RouteHopDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RouteHopDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RouteHopDecodeErrorZ extends CommonBase { */ public Result_RouteHopDecodeErrorZ clone() { long ret = bindings.CResult_RouteHopDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RouteLightningErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteLightningErrorZ.java index 62130b7f..91aeb589 100644 --- a/src/main/java/org/ldk/structs/Result_RouteLightningErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteLightningErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RouteLightningErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RouteLightningErrorZ extends CommonBase { */ public static Result_RouteLightningErrorZ ok(Route o) { long ret = bindings.CResult_RouteLightningErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RouteLightningErrorZ extends CommonBase { */ public static Result_RouteLightningErrorZ err(LightningError e) { long ret = bindings.CResult_RouteLightningErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RouteLightningErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RouteLightningErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RouteLightningErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RouteLightningErrorZ extends CommonBase { */ public Result_RouteLightningErrorZ clone() { long ret = bindings.CResult_RouteLightningErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java index 0fb8e161..0f872f1d 100644 --- a/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RouteParametersDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RouteParametersDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RouteParametersDecodeErrorZ extends CommonBase { */ public static Result_RouteParametersDecodeErrorZ ok(RouteParameters o) { long ret = bindings.CResult_RouteParametersDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteParametersDecodeErrorZ ret_hu_conv = Result_RouteParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RouteParametersDecodeErrorZ extends CommonBase { */ public static Result_RouteParametersDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RouteParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteParametersDecodeErrorZ ret_hu_conv = Result_RouteParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RouteParametersDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RouteParametersDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RouteParametersDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RouteParametersDecodeErrorZ extends CommonBase { */ public Result_RouteParametersDecodeErrorZ clone() { long ret = bindings.CResult_RouteParametersDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteParametersDecodeErrorZ ret_hu_conv = Result_RouteParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java index 0cc7fdc6..5c371e13 100644 --- a/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_RoutingFeesDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_RoutingFeesDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_RoutingFeesDecodeErrorZ extends CommonBase { */ public static Result_RoutingFeesDecodeErrorZ ok(RoutingFees o) { long ret = bindings.CResult_RoutingFeesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_RoutingFeesDecodeErrorZ extends CommonBase { */ public static Result_RoutingFeesDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_RoutingFeesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_RoutingFeesDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_RoutingFeesDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_RoutingFeesDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_RoutingFeesDecodeErrorZ extends CommonBase { */ public Result_RoutingFeesDecodeErrorZ clone() { long ret = bindings.CResult_RoutingFeesDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java index 9ffe1d69..ac43698e 100644 --- a/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ScorerDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ScorerDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ScorerDecodeErrorZ extends CommonBase { */ public static Result_ScorerDecodeErrorZ ok(ScoringParameters o_params) { long ret = bindings.CResult_ScorerDecodeErrorZ_ok(bindings.Scorer_new(o_params == null ? 0 : o_params.ptr & ~1)); + Reference.reachabilityFence(o_params); if (ret >= 0 && ret <= 4096) { return null; } Result_ScorerDecodeErrorZ ret_hu_conv = Result_ScorerDecodeErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(o_params); @@ -65,6 +67,7 @@ o_params.ptr = 0; */ public static Result_ScorerDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ScorerDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ScorerDecodeErrorZ ret_hu_conv = Result_ScorerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -75,6 +78,7 @@ o_params.ptr = 0; */ public boolean is_ok() { boolean ret = bindings.CResult_ScorerDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java index fc7ca0c4..c409555c 100644 --- a/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ScoringParametersDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ScoringParametersDecodeErrorZ extends CommonBase { @@ -44,8 +45,13 @@ public class Result_ScoringParametersDecodeErrorZ extends CommonBase { /** * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state. */ - public static Result_ScoringParametersDecodeErrorZ ok(long o_base_penalty_msat_arg, long o_failure_penalty_msat_arg, long o_failure_penalty_half_life_arg) { - long ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(bindings.ScoringParameters_new(o_base_penalty_msat_arg, o_failure_penalty_msat_arg, o_failure_penalty_half_life_arg)); + public static Result_ScoringParametersDecodeErrorZ ok(long o_base_penalty_msat_arg, long o_failure_penalty_msat_arg, short o_overuse_penalty_start_1024th_arg, long o_overuse_penalty_msat_per_1024th_arg, long o_failure_penalty_half_life_arg) { + long ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(bindings.ScoringParameters_new(o_base_penalty_msat_arg, o_failure_penalty_msat_arg, o_overuse_penalty_start_1024th_arg, o_overuse_penalty_msat_per_1024th_arg, o_failure_penalty_half_life_arg)); + Reference.reachabilityFence(o_base_penalty_msat_arg); + Reference.reachabilityFence(o_failure_penalty_msat_arg); + Reference.reachabilityFence(o_overuse_penalty_start_1024th_arg); + Reference.reachabilityFence(o_overuse_penalty_msat_per_1024th_arg); + Reference.reachabilityFence(o_failure_penalty_half_life_arg); if (ret >= 0 && ret <= 4096) { return null; } Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +62,7 @@ public class Result_ScoringParametersDecodeErrorZ extends CommonBase { */ public static Result_ScoringParametersDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ScoringParametersDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,6 +73,7 @@ public class Result_ScoringParametersDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ScoringParametersDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java index f0aeae17..775e9425 100644 --- a/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SecretKeyErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_SecretKeyErrorZ extends CommonBase { @@ -40,6 +41,7 @@ public class Result_SecretKeyErrorZ extends CommonBase { */ public static Result_SecretKeyErrorZ ok(byte[] o) { long ret = bindings.CResult_SecretKeyErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -50,6 +52,7 @@ public class Result_SecretKeyErrorZ extends CommonBase { */ public static Result_SecretKeyErrorZ err(org.ldk.enums.Secp256k1Error e) { long ret = bindings.CResult_SecretKeyErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -60,6 +63,7 @@ public class Result_SecretKeyErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_SecretKeyErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java index 9e0fc29b..c2c8b707 100644 --- a/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ShutdownDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ShutdownDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ShutdownDecodeErrorZ extends CommonBase { */ public static Result_ShutdownDecodeErrorZ ok(Shutdown o) { long ret = bindings.CResult_ShutdownDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ShutdownDecodeErrorZ extends CommonBase { */ public static Result_ShutdownDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ShutdownDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ShutdownDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ShutdownDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ShutdownDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ShutdownDecodeErrorZ extends CommonBase { */ public Result_ShutdownDecodeErrorZ clone() { long ret = bindings.CResult_ShutdownDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java index 5bf4fcb6..d4aef990 100644 --- a/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_ShutdownScriptDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ShutdownScriptDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ShutdownScriptDecodeErrorZ extends CommonBase { */ public static Result_ShutdownScriptDecodeErrorZ ok(ShutdownScript o) { long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ShutdownScriptDecodeErrorZ extends CommonBase { */ public static Result_ShutdownScriptDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ShutdownScriptDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ShutdownScriptDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ShutdownScriptDecodeErrorZ extends CommonBase { */ public Result_ShutdownScriptDecodeErrorZ clone() { long ret = bindings.CResult_ShutdownScriptDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java b/src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java index 4a51de00..2a9401a9 100644 --- a/src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java +++ b/src/main/java/org/ldk/structs/Result_ShutdownScriptInvalidShutdownScriptZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase { */ public static Result_ShutdownScriptInvalidShutdownScriptZ ok(ShutdownScript o) { long ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase { */ public static Result_ShutdownScriptInvalidShutdownScriptZ err(InvalidShutdownScript e) { long ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_ShutdownScriptInvalidShutdownScriptZ extends CommonBase { */ public Result_ShutdownScriptInvalidShutdownScriptZ clone() { long ret = bindings.CResult_ShutdownScriptInvalidShutdownScriptZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java b/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java index 0454d7a8..76dbc73d 100644 --- a/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_SiPrefixNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_SiPrefixNoneZ extends CommonBase { @@ -38,6 +39,7 @@ public class Result_SiPrefixNoneZ extends CommonBase { */ public static Result_SiPrefixNoneZ ok(org.ldk.enums.SiPrefix o) { long ret = bindings.CResult_SiPrefixNoneZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SiPrefixNoneZ ret_hu_conv = Result_SiPrefixNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_SiPrefixNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_SiPrefixNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_SiPrefixNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_SiPrefixNoneZ extends CommonBase { */ public Result_SiPrefixNoneZ clone() { long ret = bindings.CResult_SiPrefixNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_SiPrefixNoneZ ret_hu_conv = Result_SiPrefixNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java index 9f8eda0b..eabee3d8 100644 --- a/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SignDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_SignDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_SignDecodeErrorZ extends CommonBase { */ public static Result_SignDecodeErrorZ ok(Sign o) { long ret = bindings.CResult_SignDecodeErrorZ_ok(o == null ? 0 : o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(o); @@ -57,6 +59,7 @@ public class Result_SignDecodeErrorZ extends CommonBase { */ public static Result_SignDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_SignDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -67,11 +70,13 @@ public class Result_SignDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_SignDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_SignDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -81,6 +86,7 @@ public class Result_SignDecodeErrorZ extends CommonBase { */ public Result_SignDecodeErrorZ clone() { long ret = bindings.CResult_SignDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_SignatureNoneZ.java b/src/main/java/org/ldk/structs/Result_SignatureNoneZ.java index 061b1e22..3099c5ef 100644 --- a/src/main/java/org/ldk/structs/Result_SignatureNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_SignatureNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_SignatureNoneZ extends CommonBase { @@ -38,6 +39,7 @@ public class Result_SignatureNoneZ extends CommonBase { */ public static Result_SignatureNoneZ ok(byte[] o) { long ret = bindings.CResult_SignatureNoneZ_ok(InternalUtils.check_arr_len(o, 64)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_SignatureNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_SignatureNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_SignatureNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_SignatureNoneZ extends CommonBase { */ public Result_SignatureNoneZ clone() { long ret = bindings.CResult_SignatureNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java index 0f41d984..d816f661 100644 --- a/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_SignedRawInvoiceNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_SignedRawInvoiceNoneZ extends CommonBase { @@ -41,6 +42,7 @@ public class Result_SignedRawInvoiceNoneZ extends CommonBase { */ public static Result_SignedRawInvoiceNoneZ ok(SignedRawInvoice o) { long ret = bindings.CResult_SignedRawInvoiceNoneZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -61,11 +63,13 @@ public class Result_SignedRawInvoiceNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_SignedRawInvoiceNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_SignedRawInvoiceNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -75,6 +79,7 @@ public class Result_SignedRawInvoiceNoneZ extends CommonBase { */ public Result_SignedRawInvoiceNoneZ clone() { long ret = bindings.CResult_SignedRawInvoiceNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java index be931316..48adac74 100644 --- a/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_SpendableOutputDescriptorDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { */ public static Result_SpendableOutputDescriptorDecodeErrorZ ok(SpendableOutputDescriptor o) { long ret = bindings.CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { */ public static Result_SpendableOutputDescriptorDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_SpendableOutputDescriptorDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_SpendableOutputDescriptorDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_SpendableOutputDescriptorDecodeErrorZ extends CommonBase { */ public Result_SpendableOutputDescriptorDecodeErrorZ clone() { long ret = bindings.CResult_SpendableOutputDescriptorDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java index c0a4efdb..5dc85e64 100644 --- a/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_StaticPaymentOutputDescriptorDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_StaticPaymentOutputDescriptorDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_StaticPaymentOutputDescriptorDecodeErrorZ extends CommonBase */ public static Result_StaticPaymentOutputDescriptorDecodeErrorZ ok(StaticPaymentOutputDescriptor o) { long ret = bindings.CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_StaticPaymentOutputDescriptorDecodeErrorZ extends CommonBase */ public static Result_StaticPaymentOutputDescriptorDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_StaticPaymentOutputDescriptorDecodeErrorZ extends CommonBase */ public boolean is_ok() { boolean ret = bindings.CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_StaticPaymentOutputDescriptorDecodeErrorZ extends CommonBase */ public Result_StaticPaymentOutputDescriptorDecodeErrorZ clone() { long ret = bindings.CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_StringErrorZ.java b/src/main/java/org/ldk/structs/Result_StringErrorZ.java index 92a7c2a5..b2b0e5b0 100644 --- a/src/main/java/org/ldk/structs/Result_StringErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_StringErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_StringErrorZ extends CommonBase { @@ -40,6 +41,7 @@ public class Result_StringErrorZ extends CommonBase { */ public static Result_StringErrorZ ok(java.lang.String o) { long ret = bindings.CResult_StringErrorZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_StringErrorZ ret_hu_conv = Result_StringErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -50,6 +52,7 @@ public class Result_StringErrorZ extends CommonBase { */ public static Result_StringErrorZ err(org.ldk.enums.Secp256k1Error e) { long ret = bindings.CResult_StringErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_StringErrorZ ret_hu_conv = Result_StringErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -60,6 +63,7 @@ public class Result_StringErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_StringErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java b/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java index 792e4eb2..5872f9d4 100644 --- a/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_TransactionNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_TransactionNoneZ extends CommonBase { @@ -38,6 +39,7 @@ public class Result_TransactionNoneZ extends CommonBase { */ public static Result_TransactionNoneZ ok(byte[] o) { long ret = bindings.CResult_TransactionNoneZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -58,11 +60,13 @@ public class Result_TransactionNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_TransactionNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_TransactionNoneZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +76,7 @@ public class Result_TransactionNoneZ extends CommonBase { */ public Result_TransactionNoneZ clone() { long ret = bindings.CResult_TransactionNoneZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_TrustedClosingTransactionNoneZ.java b/src/main/java/org/ldk/structs/Result_TrustedClosingTransactionNoneZ.java index 0f444d5c..967b4cbc 100644 --- a/src/main/java/org/ldk/structs/Result_TrustedClosingTransactionNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_TrustedClosingTransactionNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_TrustedClosingTransactionNoneZ extends CommonBase { @@ -41,6 +42,7 @@ public class Result_TrustedClosingTransactionNoneZ extends CommonBase { */ public static Result_TrustedClosingTransactionNoneZ ok(TrustedClosingTransaction o) { long ret = bindings.CResult_TrustedClosingTransactionNoneZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(o); @@ -70,6 +72,7 @@ public class Result_TrustedClosingTransactionNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_TrustedClosingTransactionNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_TrustedCommitmentTransactionNoneZ.java b/src/main/java/org/ldk/structs/Result_TrustedCommitmentTransactionNoneZ.java index fdf1d8b1..929f297b 100644 --- a/src/main/java/org/ldk/structs/Result_TrustedCommitmentTransactionNoneZ.java +++ b/src/main/java/org/ldk/structs/Result_TrustedCommitmentTransactionNoneZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_TrustedCommitmentTransactionNoneZ extends CommonBase { @@ -41,6 +42,7 @@ public class Result_TrustedCommitmentTransactionNoneZ extends CommonBase { */ public static Result_TrustedCommitmentTransactionNoneZ ok(TrustedCommitmentTransaction o) { long ret = bindings.CResult_TrustedCommitmentTransactionNoneZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_TrustedCommitmentTransactionNoneZ ret_hu_conv = Result_TrustedCommitmentTransactionNoneZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(o); @@ -70,6 +72,7 @@ public class Result_TrustedCommitmentTransactionNoneZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_TrustedCommitmentTransactionNoneZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java index deba6a76..6ef4004b 100644 --- a/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_TxCreationKeysDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { */ public static Result_TxCreationKeysDecodeErrorZ ok(TxCreationKeys o) { long ret = bindings.CResult_TxCreationKeysDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysDecodeErrorZ ret_hu_conv = Result_TxCreationKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { */ public static Result_TxCreationKeysDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_TxCreationKeysDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysDecodeErrorZ ret_hu_conv = Result_TxCreationKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_TxCreationKeysDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_TxCreationKeysDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_TxCreationKeysDecodeErrorZ extends CommonBase { */ public Result_TxCreationKeysDecodeErrorZ clone() { long ret = bindings.CResult_TxCreationKeysDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysDecodeErrorZ ret_hu_conv = Result_TxCreationKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java b/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java index 1ed03f74..630b5f8b 100644 --- a/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_TxCreationKeysErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_TxCreationKeysErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_TxCreationKeysErrorZ extends CommonBase { */ public static Result_TxCreationKeysErrorZ ok(TxCreationKeys o) { long ret = bindings.CResult_TxCreationKeysErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_TxCreationKeysErrorZ extends CommonBase { */ public static Result_TxCreationKeysErrorZ err(org.ldk.enums.Secp256k1Error e) { long ret = bindings.CResult_TxCreationKeysErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_TxCreationKeysErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_TxCreationKeysErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_TxCreationKeysErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_TxCreationKeysErrorZ extends CommonBase { */ public Result_TxCreationKeysErrorZ clone() { long ret = bindings.CResult_TxCreationKeysErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java b/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java index 3c9f47ef..be96d9ed 100644 --- a/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_TxOutAccessErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_TxOutAccessErrorZ extends CommonBase { @@ -42,6 +43,7 @@ public class Result_TxOutAccessErrorZ extends CommonBase { */ public static Result_TxOutAccessErrorZ ok(TxOut o) { long ret = bindings.CResult_TxOutAccessErrorZ_ok(o.ptr); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -52,6 +54,7 @@ public class Result_TxOutAccessErrorZ extends CommonBase { */ public static Result_TxOutAccessErrorZ err(org.ldk.enums.AccessError e) { long ret = bindings.CResult_TxOutAccessErrorZ_err(e); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -62,11 +65,13 @@ public class Result_TxOutAccessErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_TxOutAccessErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_TxOutAccessErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -76,6 +81,7 @@ public class Result_TxOutAccessErrorZ extends CommonBase { */ public Result_TxOutAccessErrorZ clone() { long ret = bindings.CResult_TxOutAccessErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java index 715ab33a..0c20254b 100644 --- a/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UnsignedChannelAnnouncementDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UnsignedChannelAnnouncementDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UnsignedChannelAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_UnsignedChannelAnnouncementDecodeErrorZ ok(UnsignedChannelAnnouncement o) { long ret = bindings.CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UnsignedChannelAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_UnsignedChannelAnnouncementDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UnsignedChannelAnnouncementDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UnsignedChannelAnnouncementDecodeErrorZ extends CommonBase { */ public Result_UnsignedChannelAnnouncementDecodeErrorZ clone() { long ret = bindings.CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java index 9f43f1c0..05d27e3b 100644 --- a/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UnsignedChannelUpdateDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UnsignedChannelUpdateDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UnsignedChannelUpdateDecodeErrorZ extends CommonBase { */ public static Result_UnsignedChannelUpdateDecodeErrorZ ok(UnsignedChannelUpdate o) { long ret = bindings.CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UnsignedChannelUpdateDecodeErrorZ extends CommonBase { */ public static Result_UnsignedChannelUpdateDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UnsignedChannelUpdateDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UnsignedChannelUpdateDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UnsignedChannelUpdateDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UnsignedChannelUpdateDecodeErrorZ extends CommonBase { */ public Result_UnsignedChannelUpdateDecodeErrorZ clone() { long ret = bindings.CResult_UnsignedChannelUpdateDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java index 2abc39ee..8a8afa35 100644 --- a/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UnsignedNodeAnnouncementDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UnsignedNodeAnnouncementDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UnsignedNodeAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_UnsignedNodeAnnouncementDecodeErrorZ ok(UnsignedNodeAnnouncement o) { long ret = bindings.CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UnsignedNodeAnnouncementDecodeErrorZ extends CommonBase { */ public static Result_UnsignedNodeAnnouncementDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UnsignedNodeAnnouncementDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UnsignedNodeAnnouncementDecodeErrorZ extends CommonBase { */ public Result_UnsignedNodeAnnouncementDecodeErrorZ clone() { long ret = bindings.CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java index d6a723d4..30f152bf 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateAddHTLCDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateAddHTLCDecodeErrorZ ok(UpdateAddHTLC o) { long ret = bindings.CResult_UpdateAddHTLCDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateAddHTLCDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UpdateAddHTLCDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UpdateAddHTLCDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UpdateAddHTLCDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UpdateAddHTLCDecodeErrorZ extends CommonBase { */ public Result_UpdateAddHTLCDecodeErrorZ clone() { long ret = bindings.CResult_UpdateAddHTLCDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java index bb368b9b..5f505353 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFailHTLCDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateFailHTLCDecodeErrorZ ok(UpdateFailHTLC o) { long ret = bindings.CResult_UpdateFailHTLCDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateFailHTLCDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UpdateFailHTLCDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UpdateFailHTLCDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UpdateFailHTLCDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UpdateFailHTLCDecodeErrorZ extends CommonBase { */ public Result_UpdateFailHTLCDecodeErrorZ clone() { long ret = bindings.CResult_UpdateFailHTLCDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java index 38f3f13a..0dda70fd 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFailMalformedHTLCDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateFailMalformedHTLCDecodeErrorZ ok(UpdateFailMalformedHTLC o) { long ret = bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailMalformedHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateFailMalformedHTLCDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailMalformedHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UpdateFailMalformedHTLCDecodeErrorZ extends CommonBase { */ public Result_UpdateFailMalformedHTLCDecodeErrorZ clone() { long ret = bindings.CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailMalformedHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java index 92e95a43..399d746e 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFeeDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UpdateFeeDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UpdateFeeDecodeErrorZ extends CommonBase { */ public static Result_UpdateFeeDecodeErrorZ ok(UpdateFee o) { long ret = bindings.CResult_UpdateFeeDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UpdateFeeDecodeErrorZ extends CommonBase { */ public static Result_UpdateFeeDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UpdateFeeDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UpdateFeeDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UpdateFeeDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UpdateFeeDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UpdateFeeDecodeErrorZ extends CommonBase { */ public Result_UpdateFeeDecodeErrorZ clone() { long ret = bindings.CResult_UpdateFeeDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java b/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java index a282998a..60b18bf9 100644 --- a/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_UpdateFulfillHTLCDecodeErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { @@ -46,6 +47,7 @@ public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateFulfillHTLCDecodeErrorZ ok(UpdateFulfillHTLC o) { long ret = bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -56,6 +58,7 @@ public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { */ public static Result_UpdateFulfillHTLCDecodeErrorZ err(DecodeError e) { long ret = bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -66,11 +69,13 @@ public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +85,7 @@ public class Result_UpdateFulfillHTLCDecodeErrorZ extends CommonBase { */ public Result_UpdateFulfillHTLCDecodeErrorZ clone() { long ret = bindings.CResult_UpdateFulfillHTLCDecodeErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java index c3473d2a..956041ba 100644 --- a/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java +++ b/src/main/java/org/ldk/structs/Result__u832APIErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result__u832APIErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result__u832APIErrorZ extends CommonBase { */ public static Result__u832APIErrorZ ok(byte[] o) { long ret = bindings.CResult__u832APIErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result__u832APIErrorZ extends CommonBase { */ public static Result__u832APIErrorZ err(APIError e) { long ret = bindings.CResult__u832APIErrorZ_err(e.ptr); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result__u832APIErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult__u832APIErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult__u832APIErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result__u832APIErrorZ extends CommonBase { */ public Result__u832APIErrorZ clone() { long ret = bindings.CResult__u832APIErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result__u832APIErrorZ ret_hu_conv = Result__u832APIErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_boolLightningErrorZ.java b/src/main/java/org/ldk/structs/Result_boolLightningErrorZ.java index 6def50e3..b5c7921c 100644 --- a/src/main/java/org/ldk/structs/Result_boolLightningErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_boolLightningErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_boolLightningErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_boolLightningErrorZ extends CommonBase { */ public static Result_boolLightningErrorZ ok(boolean o) { long ret = bindings.CResult_boolLightningErrorZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_boolLightningErrorZ extends CommonBase { */ public static Result_boolLightningErrorZ err(LightningError e) { long ret = bindings.CResult_boolLightningErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_boolLightningErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_boolLightningErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_boolLightningErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_boolLightningErrorZ extends CommonBase { */ public Result_boolLightningErrorZ clone() { long ret = bindings.CResult_boolLightningErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java b/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java index b409c2f7..1bf879d7 100644 --- a/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java +++ b/src/main/java/org/ldk/structs/Result_boolPeerHandleErrorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class Result_boolPeerHandleErrorZ extends CommonBase { @@ -43,6 +44,7 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { */ public static Result_boolPeerHandleErrorZ ok(boolean o) { long ret = bindings.CResult_boolPeerHandleErrorZ_ok(o); + Reference.reachabilityFence(o); if (ret >= 0 && ret <= 4096) { return null; } Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -53,6 +55,7 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { */ public static Result_boolPeerHandleErrorZ err(PeerHandleError e) { long ret = bindings.CResult_boolPeerHandleErrorZ_err(e == null ? 0 : e.ptr & ~1); + Reference.reachabilityFence(e); if (ret >= 0 && ret <= 4096) { return null; } Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -63,11 +66,13 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { */ public boolean is_ok() { boolean ret = bindings.CResult_boolPeerHandleErrorZ_is_ok(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.CResult_boolPeerHandleErrorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +82,7 @@ public class Result_boolPeerHandleErrorZ extends CommonBase { */ public Result_boolPeerHandleErrorZ clone() { long ret = bindings.CResult_boolPeerHandleErrorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_boolPeerHandleErrorZ ret_hu_conv = Result_boolPeerHandleErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RetryAttempts.java b/src/main/java/org/ldk/structs/RetryAttempts.java index af587789..84f832ee 100644 --- a/src/main/java/org/ldk/structs/RetryAttempts.java +++ b/src/main/java/org/ldk/structs/RetryAttempts.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,11 +26,14 @@ public class RetryAttempts extends CommonBase { public long get_a() { long ret = bindings.RetryAttempts_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } public void set_a(long val) { bindings.RetryAttempts_set_a(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -37,6 +41,7 @@ public class RetryAttempts extends CommonBase { */ public static RetryAttempts of(long a_arg) { long ret = bindings.RetryAttempts_new(a_arg); + Reference.reachabilityFence(a_arg); if (ret >= 0 && ret <= 4096) { return null; } RetryAttempts ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RetryAttempts(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -45,6 +50,7 @@ public class RetryAttempts extends CommonBase { long clone_ptr() { long ret = bindings.RetryAttempts_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +59,7 @@ public class RetryAttempts extends CommonBase { */ public RetryAttempts clone() { long ret = bindings.RetryAttempts_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RetryAttempts ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RetryAttempts(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -66,16 +73,26 @@ public class RetryAttempts extends CommonBase { */ public boolean eq(RetryAttempts b) { boolean ret = bindings.RetryAttempts_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RetryAttempts)) return false; + return this.eq((RetryAttempts)o); + } /** * Checks if two RetryAttemptss contain equal inner contents. */ public long hash() { long ret = bindings.RetryAttempts_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } } diff --git a/src/main/java/org/ldk/structs/RevokeAndACK.java b/src/main/java/org/ldk/structs/RevokeAndACK.java index dc58cb4e..8284f9e3 100644 --- a/src/main/java/org/ldk/structs/RevokeAndACK.java +++ b/src/main/java/org/ldk/structs/RevokeAndACK.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class RevokeAndACK extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.RevokeAndACK_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class RevokeAndACK extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.RevokeAndACK_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class RevokeAndACK extends CommonBase { */ public byte[] get_per_commitment_secret() { byte[] ret = bindings.RevokeAndACK_get_per_commitment_secret(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class RevokeAndACK extends CommonBase { */ public void set_per_commitment_secret(byte[] val) { bindings.RevokeAndACK_set_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class RevokeAndACK extends CommonBase { */ public byte[] get_next_per_commitment_point() { byte[] ret = bindings.RevokeAndACK_get_next_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class RevokeAndACK extends CommonBase { */ public void set_next_per_commitment_point(byte[] val) { bindings.RevokeAndACK_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,9 @@ public class RevokeAndACK extends CommonBase { */ public static RevokeAndACK of(byte[] channel_id_arg, byte[] per_commitment_secret_arg, byte[] next_per_commitment_point_arg) { long ret = bindings.RevokeAndACK_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(per_commitment_secret_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33)); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(per_commitment_secret_arg); + Reference.reachabilityFence(next_per_commitment_point_arg); if (ret >= 0 && ret <= 4096) { return null; } RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RevokeAndACK(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -77,6 +90,7 @@ public class RevokeAndACK extends CommonBase { long clone_ptr() { long ret = bindings.RevokeAndACK_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -85,6 +99,7 @@ public class RevokeAndACK extends CommonBase { */ public RevokeAndACK clone() { long ret = bindings.RevokeAndACK_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RevokeAndACK(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -96,6 +111,7 @@ public class RevokeAndACK extends CommonBase { */ public byte[] write() { byte[] ret = bindings.RevokeAndACK_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -104,6 +120,7 @@ public class RevokeAndACK extends CommonBase { */ public static Result_RevokeAndACKDecodeErrorZ read(byte[] ser) { long ret = bindings.RevokeAndACK_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Route.java b/src/main/java/org/ldk/structs/Route.java index 453292e8..0a7a0efa 100644 --- a/src/main/java/org/ldk/structs/Route.java +++ b/src/main/java/org/ldk/structs/Route.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -30,6 +31,7 @@ public class Route extends CommonBase { */ public RouteHop[][] get_paths() { long[][] ret = bindings.Route_get_paths(this.ptr); + Reference.reachabilityFence(this); RouteHop[][] ret_conv_12_arr = new RouteHop[ret.length][]; for (int m = 0; m < ret.length; m++) { long[] ret_conv_12 = ret[m]; @@ -55,6 +57,8 @@ public class Route extends CommonBase { */ public void set_paths(RouteHop[][] val) { bindings.Route_set_paths(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12 != null ? Arrays.stream(val_conv_12).mapToLong(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray() : null).toArray(long[][]::new) : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +73,7 @@ public class Route extends CommonBase { @Nullable public Payee get_payee() { long ret = bindings.Route_get_payee(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -86,6 +91,8 @@ public class Route extends CommonBase { */ public void set_payee(@Nullable Payee val) { bindings.Route_set_payee(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -93,6 +100,8 @@ public class Route extends CommonBase { */ public static Route of(RouteHop[][] paths_arg, Payee payee_arg) { long ret = bindings.Route_new(paths_arg != null ? Arrays.stream(paths_arg).map(paths_arg_conv_12 -> paths_arg_conv_12 != null ? Arrays.stream(paths_arg_conv_12).mapToLong(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray() : null).toArray(long[][]::new) : null, payee_arg == null ? 0 : payee_arg.ptr & ~1); + Reference.reachabilityFence(paths_arg); + Reference.reachabilityFence(payee_arg); if (ret >= 0 && ret <= 4096) { return null; } Route ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Route(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -101,6 +110,7 @@ public class Route extends CommonBase { long clone_ptr() { long ret = bindings.Route_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -109,6 +119,7 @@ public class Route extends CommonBase { */ public Route clone() { long ret = bindings.Route_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Route ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Route(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -120,9 +131,13 @@ public class Route extends CommonBase { */ public long hash() { long ret = bindings.Route_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two Routes contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -130,10 +145,16 @@ public class Route extends CommonBase { */ public boolean eq(Route b) { boolean ret = bindings.Route_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Route)) return false; + return this.eq((Route)o); + } /** * Returns the total amount of fees paid on this [`Route`]. * @@ -142,6 +163,7 @@ public class Route extends CommonBase { */ public long get_total_fees() { long ret = bindings.Route_get_total_fees(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -150,6 +172,7 @@ public class Route extends CommonBase { */ public long get_total_amount() { long ret = bindings.Route_get_total_amount(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -158,6 +181,7 @@ public class Route extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Route_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -166,6 +190,7 @@ public class Route extends CommonBase { */ public static Result_RouteDecodeErrorZ read(byte[] ser) { long ret = bindings.Route_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RouteHint.java b/src/main/java/org/ldk/structs/RouteHint.java index 6ead7770..849ea623 100644 --- a/src/main/java/org/ldk/structs/RouteHint.java +++ b/src/main/java/org/ldk/structs/RouteHint.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class RouteHint extends CommonBase { public RouteHintHop[] get_a() { long[] ret = bindings.RouteHint_get_a(this.ptr); + Reference.reachabilityFence(this); RouteHintHop[] ret_conv_14_arr = new RouteHintHop[ret.length]; for (int o = 0; o < ret.length; o++) { long ret_conv_14 = ret[o]; @@ -33,6 +35,8 @@ public class RouteHint extends CommonBase { public void set_a(RouteHintHop[] val) { bindings.RouteHint_set_a(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_14 -> val_conv_14 == null ? 0 : val_conv_14.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -40,6 +44,7 @@ public class RouteHint extends CommonBase { */ public static RouteHint of(RouteHintHop[] a_arg) { long ret = bindings.RouteHint_new(a_arg != null ? Arrays.stream(a_arg).mapToLong(a_arg_conv_14 -> a_arg_conv_14 == null ? 0 : a_arg_conv_14.ptr & ~1).toArray() : null); + Reference.reachabilityFence(a_arg); if (ret >= 0 && ret <= 4096) { return null; } RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -48,6 +53,7 @@ public class RouteHint extends CommonBase { long clone_ptr() { long ret = bindings.RouteHint_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -56,6 +62,7 @@ public class RouteHint extends CommonBase { */ public RouteHint clone() { long ret = bindings.RouteHint_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RouteHint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -67,9 +74,13 @@ public class RouteHint extends CommonBase { */ public long hash() { long ret = bindings.RouteHint_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two RouteHints contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -77,15 +88,22 @@ public class RouteHint extends CommonBase { */ public boolean eq(RouteHint b) { boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RouteHint)) return false; + return this.eq((RouteHint)o); + } /** * Serialize the RouteHint object into a byte array which can be read by RouteHint_read */ public byte[] write() { byte[] ret = bindings.RouteHint_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -94,6 +112,7 @@ public class RouteHint extends CommonBase { */ public static Result_RouteHintDecodeErrorZ read(byte[] ser) { long ret = bindings.RouteHint_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintDecodeErrorZ ret_hu_conv = Result_RouteHintDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RouteHintHop.java b/src/main/java/org/ldk/structs/RouteHintHop.java index 47f38b33..d7ed5a4a 100644 --- a/src/main/java/org/ldk/structs/RouteHintHop.java +++ b/src/main/java/org/ldk/structs/RouteHintHop.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class RouteHintHop extends CommonBase { */ public byte[] get_src_node_id() { byte[] ret = bindings.RouteHintHop_get_src_node_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class RouteHintHop extends CommonBase { */ public void set_src_node_id(byte[] val) { bindings.RouteHintHop_set_src_node_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class RouteHintHop extends CommonBase { */ public long get_short_channel_id() { long ret = bindings.RouteHintHop_get_short_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class RouteHintHop extends CommonBase { */ public void set_short_channel_id(long val) { bindings.RouteHintHop_set_short_channel_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class RouteHintHop extends CommonBase { */ public RoutingFees get_fees() { long ret = bindings.RouteHintHop_get_fees(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -65,6 +73,8 @@ public class RouteHintHop extends CommonBase { */ public void set_fees(RoutingFees val) { bindings.RouteHintHop_set_fees(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +82,7 @@ public class RouteHintHop extends CommonBase { */ public short get_cltv_expiry_delta() { short ret = bindings.RouteHintHop_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +91,8 @@ public class RouteHintHop extends CommonBase { */ public void set_cltv_expiry_delta(short val) { bindings.RouteHintHop_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -87,6 +100,7 @@ public class RouteHintHop extends CommonBase { */ public Option_u64Z get_htlc_minimum_msat() { long ret = bindings.RouteHintHop_get_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -98,6 +112,8 @@ public class RouteHintHop extends CommonBase { */ public void set_htlc_minimum_msat(Option_u64Z val) { bindings.RouteHintHop_set_htlc_minimum_msat(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -105,6 +121,7 @@ public class RouteHintHop extends CommonBase { */ public Option_u64Z get_htlc_maximum_msat() { long ret = bindings.RouteHintHop_get_htlc_maximum_msat(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -116,6 +133,8 @@ public class RouteHintHop extends CommonBase { */ public void set_htlc_maximum_msat(Option_u64Z val) { bindings.RouteHintHop_set_htlc_maximum_msat(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -123,6 +142,12 @@ public class RouteHintHop extends CommonBase { */ public static RouteHintHop of(byte[] src_node_id_arg, long short_channel_id_arg, RoutingFees fees_arg, short cltv_expiry_delta_arg, Option_u64Z htlc_minimum_msat_arg, Option_u64Z htlc_maximum_msat_arg) { long ret = bindings.RouteHintHop_new(InternalUtils.check_arr_len(src_node_id_arg, 33), short_channel_id_arg, fees_arg == null ? 0 : fees_arg.ptr & ~1, cltv_expiry_delta_arg, htlc_minimum_msat_arg.ptr, htlc_maximum_msat_arg.ptr); + Reference.reachabilityFence(src_node_id_arg); + Reference.reachabilityFence(short_channel_id_arg); + Reference.reachabilityFence(fees_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); + Reference.reachabilityFence(htlc_minimum_msat_arg); + Reference.reachabilityFence(htlc_maximum_msat_arg); if (ret >= 0 && ret <= 4096) { return null; } RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHintHop(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -131,6 +156,7 @@ public class RouteHintHop extends CommonBase { long clone_ptr() { long ret = bindings.RouteHintHop_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -139,6 +165,7 @@ public class RouteHintHop extends CommonBase { */ public RouteHintHop clone() { long ret = bindings.RouteHintHop_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RouteHintHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHintHop(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -150,9 +177,13 @@ public class RouteHintHop extends CommonBase { */ public long hash() { long ret = bindings.RouteHintHop_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two RouteHintHops contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -160,15 +191,22 @@ public class RouteHintHop extends CommonBase { */ public boolean eq(RouteHintHop b) { boolean ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RouteHintHop)) return false; + return this.eq((RouteHintHop)o); + } /** * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read */ public byte[] write() { byte[] ret = bindings.RouteHintHop_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -177,6 +215,7 @@ public class RouteHintHop extends CommonBase { */ public static Result_RouteHintHopDecodeErrorZ read(byte[] ser) { long ret = bindings.RouteHintHop_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHintHopDecodeErrorZ ret_hu_conv = Result_RouteHintHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RouteHop.java b/src/main/java/org/ldk/structs/RouteHop.java index f2168f4b..c7c3c80b 100644 --- a/src/main/java/org/ldk/structs/RouteHop.java +++ b/src/main/java/org/ldk/structs/RouteHop.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class RouteHop extends CommonBase { */ public byte[] get_pubkey() { byte[] ret = bindings.RouteHop_get_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class RouteHop extends CommonBase { */ public void set_pubkey(byte[] val) { bindings.RouteHop_set_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -40,6 +44,7 @@ public class RouteHop extends CommonBase { */ public NodeFeatures get_node_features() { long ret = bindings.RouteHop_get_node_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -52,6 +57,8 @@ public class RouteHop extends CommonBase { */ public void set_node_features(NodeFeatures val) { bindings.RouteHop_set_node_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -59,6 +66,7 @@ public class RouteHop extends CommonBase { */ public long get_short_channel_id() { long ret = bindings.RouteHop_get_short_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -67,6 +75,8 @@ public class RouteHop extends CommonBase { */ public void set_short_channel_id(long val) { bindings.RouteHop_set_short_channel_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -75,6 +85,7 @@ public class RouteHop extends CommonBase { */ public ChannelFeatures get_channel_features() { long ret = bindings.RouteHop_get_channel_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -87,6 +98,8 @@ public class RouteHop extends CommonBase { */ public void set_channel_features(ChannelFeatures val) { bindings.RouteHop_set_channel_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -96,6 +109,7 @@ public class RouteHop extends CommonBase { */ public long get_fee_msat() { long ret = bindings.RouteHop_get_fee_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -106,6 +120,8 @@ public class RouteHop extends CommonBase { */ public void set_fee_msat(long val) { bindings.RouteHop_set_fee_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -114,6 +130,7 @@ public class RouteHop extends CommonBase { */ public int get_cltv_expiry_delta() { int ret = bindings.RouteHop_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -123,6 +140,8 @@ public class RouteHop extends CommonBase { */ public void set_cltv_expiry_delta(int val) { bindings.RouteHop_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -130,6 +149,12 @@ public class RouteHop extends CommonBase { */ public static RouteHop of(byte[] pubkey_arg, NodeFeatures node_features_arg, long short_channel_id_arg, ChannelFeatures channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg) { long ret = bindings.RouteHop_new(InternalUtils.check_arr_len(pubkey_arg, 33), node_features_arg == null ? 0 : node_features_arg.ptr & ~1, short_channel_id_arg, channel_features_arg == null ? 0 : channel_features_arg.ptr & ~1, fee_msat_arg, cltv_expiry_delta_arg); + Reference.reachabilityFence(pubkey_arg); + Reference.reachabilityFence(node_features_arg); + Reference.reachabilityFence(short_channel_id_arg); + Reference.reachabilityFence(channel_features_arg); + Reference.reachabilityFence(fee_msat_arg); + Reference.reachabilityFence(cltv_expiry_delta_arg); if (ret >= 0 && ret <= 4096) { return null; } RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHop(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -138,6 +163,7 @@ public class RouteHop extends CommonBase { long clone_ptr() { long ret = bindings.RouteHop_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -146,6 +172,7 @@ public class RouteHop extends CommonBase { */ public RouteHop clone() { long ret = bindings.RouteHop_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RouteHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteHop(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -157,9 +184,13 @@ public class RouteHop extends CommonBase { */ public long hash() { long ret = bindings.RouteHop_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two RouteHops contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -167,15 +198,22 @@ public class RouteHop extends CommonBase { */ public boolean eq(RouteHop b) { boolean ret = bindings.RouteHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RouteHop)) return false; + return this.eq((RouteHop)o); + } /** * Serialize the RouteHop object into a byte array which can be read by RouteHop_read */ public byte[] write() { byte[] ret = bindings.RouteHop_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -184,6 +222,7 @@ public class RouteHop extends CommonBase { */ public static Result_RouteHopDecodeErrorZ read(byte[] ser) { long ret = bindings.RouteHop_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteHopDecodeErrorZ ret_hu_conv = Result_RouteHopDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RouteParameters.java b/src/main/java/org/ldk/structs/RouteParameters.java index 66561f73..c7bd3b68 100644 --- a/src/main/java/org/ldk/structs/RouteParameters.java +++ b/src/main/java/org/ldk/structs/RouteParameters.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -29,6 +30,7 @@ public class RouteParameters extends CommonBase { */ public Payee get_payee() { long ret = bindings.RouteParameters_get_payee(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Payee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Payee(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,6 +42,8 @@ public class RouteParameters extends CommonBase { */ public void set_payee(Payee val) { bindings.RouteParameters_set_payee(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -47,6 +51,7 @@ public class RouteParameters extends CommonBase { */ public long get_final_value_msat() { long ret = bindings.RouteParameters_get_final_value_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -55,6 +60,8 @@ public class RouteParameters extends CommonBase { */ public void set_final_value_msat(long val) { bindings.RouteParameters_set_final_value_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -62,6 +69,7 @@ public class RouteParameters extends CommonBase { */ public int get_final_cltv_expiry_delta() { int ret = bindings.RouteParameters_get_final_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,6 +78,8 @@ public class RouteParameters extends CommonBase { */ public void set_final_cltv_expiry_delta(int val) { bindings.RouteParameters_set_final_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -77,6 +87,9 @@ public class RouteParameters extends CommonBase { */ public static RouteParameters of(Payee payee_arg, long final_value_msat_arg, int final_cltv_expiry_delta_arg) { long ret = bindings.RouteParameters_new(payee_arg == null ? 0 : payee_arg.ptr & ~1, final_value_msat_arg, final_cltv_expiry_delta_arg); + Reference.reachabilityFence(payee_arg); + Reference.reachabilityFence(final_value_msat_arg); + Reference.reachabilityFence(final_cltv_expiry_delta_arg); if (ret >= 0 && ret <= 4096) { return null; } RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -85,6 +98,7 @@ public class RouteParameters extends CommonBase { long clone_ptr() { long ret = bindings.RouteParameters_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -93,6 +107,7 @@ public class RouteParameters extends CommonBase { */ public RouteParameters clone() { long ret = bindings.RouteParameters_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RouteParameters(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -104,6 +119,7 @@ public class RouteParameters extends CommonBase { */ public byte[] write() { byte[] ret = bindings.RouteParameters_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -112,6 +128,7 @@ public class RouteParameters extends CommonBase { */ public static Result_RouteParametersDecodeErrorZ read(byte[] ser) { long ret = bindings.RouteParameters_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteParametersDecodeErrorZ ret_hu_conv = Result_RouteParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Router.java b/src/main/java/org/ldk/structs/Router.java index b83762e1..1bfbc31a 100644 --- a/src/main/java/org/ldk/structs/Router.java +++ b/src/main/java/org/ldk/structs/Router.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -29,13 +30,13 @@ public class Router extends CommonBase { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters params, ChannelDetails[] first_hops, Score scorer); + Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters params, byte[] payment_hash, ChannelDetails[] first_hops, Score scorer); } private static class LDKRouterHolder { Router held; } public static Router new_impl(RouterInterface arg) { final LDKRouterHolder impl_holder = new LDKRouterHolder(); impl_holder.held = new Router(new bindings.LDKRouter() { - @Override public long find_route(byte[] payer, long params, long[] first_hops, long scorer) { + @Override public long find_route(byte[] payer, long params, byte[] payment_hash, long[] first_hops, long scorer) { RouteParameters params_hu_conv = null; if (params < 0 || params > 4096) { params_hu_conv = new RouteParameters(null, params); } ChannelDetails[] first_hops_conv_16_arr = new ChannelDetails[first_hops.length]; for (int q = 0; q < first_hops.length; q++) { @@ -46,7 +47,7 @@ public class Router extends CommonBase { } Score ret_hu_conv = new Score(null, scorer); ret_hu_conv.ptrs_to.add(this); - Result_RouteLightningErrorZ ret = arg.find_route(payer, params_hu_conv, first_hops_conv_16_arr, ret_hu_conv); + Result_RouteLightningErrorZ ret = arg.find_route(payer, params_hu_conv, payment_hash, first_hops_conv_16_arr, ret_hu_conv); long result = ret == null ? 0 : ret.clone_ptr(); return result; } @@ -58,8 +59,14 @@ public class Router extends CommonBase { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters params, @Nullable ChannelDetails[] first_hops, Score scorer) { - long ret = bindings.Router_find_route(this.ptr, InternalUtils.check_arr_len(payer, 33), params == null ? 0 : params.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, scorer == null ? 0 : scorer.ptr); + public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters params, byte[] payment_hash, @Nullable ChannelDetails[] first_hops, Score scorer) { + long ret = bindings.Router_find_route(this.ptr, InternalUtils.check_arr_len(payer, 33), params == null ? 0 : params.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, scorer == null ? 0 : scorer.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(payer); + Reference.reachabilityFence(params); + Reference.reachabilityFence(payment_hash); + Reference.reachabilityFence(first_hops); + Reference.reachabilityFence(scorer); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(params); diff --git a/src/main/java/org/ldk/structs/RoutingFees.java b/src/main/java/org/ldk/structs/RoutingFees.java index dfca382a..d1c885ff 100644 --- a/src/main/java/org/ldk/structs/RoutingFees.java +++ b/src/main/java/org/ldk/structs/RoutingFees.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class RoutingFees extends CommonBase { */ public int get_base_msat() { int ret = bindings.RoutingFees_get_base_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class RoutingFees extends CommonBase { */ public void set_base_msat(int val) { bindings.RoutingFees_set_base_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -40,6 +44,7 @@ public class RoutingFees extends CommonBase { */ public int get_proportional_millionths() { int ret = bindings.RoutingFees_get_proportional_millionths(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +54,8 @@ public class RoutingFees extends CommonBase { */ public void set_proportional_millionths(int val) { bindings.RoutingFees_set_proportional_millionths(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -56,6 +63,8 @@ public class RoutingFees extends CommonBase { */ public static RoutingFees of(int base_msat_arg, int proportional_millionths_arg) { long ret = bindings.RoutingFees_new(base_msat_arg, proportional_millionths_arg); + Reference.reachabilityFence(base_msat_arg); + Reference.reachabilityFence(proportional_millionths_arg); if (ret >= 0 && ret <= 4096) { return null; } RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -69,12 +78,19 @@ public class RoutingFees extends CommonBase { */ public boolean eq(RoutingFees b) { boolean ret = bindings.RoutingFees_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof RoutingFees)) return false; + return this.eq((RoutingFees)o); + } long clone_ptr() { long ret = bindings.RoutingFees_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -83,6 +99,7 @@ public class RoutingFees extends CommonBase { */ public RoutingFees clone() { long ret = bindings.RoutingFees_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RoutingFees ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RoutingFees(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -94,14 +111,19 @@ public class RoutingFees extends CommonBase { */ public long hash() { long ret = bindings.RoutingFees_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read */ public byte[] write() { byte[] ret = bindings.RoutingFees_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -110,6 +132,7 @@ public class RoutingFees extends CommonBase { */ public static Result_RoutingFeesDecodeErrorZ read(byte[] ser) { long ret = bindings.RoutingFees_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_RoutingFeesDecodeErrorZ ret_hu_conv = Result_RoutingFeesDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/RoutingMessageHandler.java b/src/main/java/org/ldk/structs/RoutingMessageHandler.java index c821ddce..49a7a6c7 100644 --- a/src/main/java/org/ldk/structs/RoutingMessageHandler.java +++ b/src/main/java/org/ldk/structs/RoutingMessageHandler.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -174,6 +175,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_boolLightningErrorZ handle_node_announcement(NodeAnnouncement msg) { long ret = bindings.RoutingMessageHandler_handle_node_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -186,6 +189,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_boolLightningErrorZ handle_channel_announcement(ChannelAnnouncement msg) { long ret = bindings.RoutingMessageHandler_handle_channel_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -198,6 +203,8 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_boolLightningErrorZ handle_channel_update(ChannelUpdate msg) { long ret = bindings.RoutingMessageHandler_handle_channel_update(this.ptr, msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_boolLightningErrorZ ret_hu_conv = Result_boolLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); @@ -211,6 +218,9 @@ public class RoutingMessageHandler extends CommonBase { */ public ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ[] get_next_channel_announcements(long starting_point, byte batch_amount) { long[] ret = bindings.RoutingMessageHandler_get_next_channel_announcements(this.ptr, starting_point, batch_amount); + Reference.reachabilityFence(this); + Reference.reachabilityFence(starting_point); + Reference.reachabilityFence(batch_amount); ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ[] ret_conv_59_arr = new ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ[ret.length]; for (int h = 0; h < ret.length; h++) { long ret_conv_59 = ret[h]; @@ -231,6 +241,9 @@ public class RoutingMessageHandler extends CommonBase { */ public NodeAnnouncement[] get_next_node_announcements(@Nullable byte[] starting_point, byte batch_amount) { long[] ret = bindings.RoutingMessageHandler_get_next_node_announcements(this.ptr, InternalUtils.check_arr_len(starting_point, 33), batch_amount); + Reference.reachabilityFence(this); + Reference.reachabilityFence(starting_point); + Reference.reachabilityFence(batch_amount); NodeAnnouncement[] ret_conv_18_arr = new NodeAnnouncement[ret.length]; for (int s = 0; s < ret.length; s++) { long ret_conv_18 = ret[s]; @@ -248,6 +261,9 @@ public class RoutingMessageHandler extends CommonBase { */ public void sync_routing_table(byte[] their_node_id, Init init) { bindings.RoutingMessageHandler_sync_routing_table(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), init == null ? 0 : init.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(init); this.ptrs_to.add(init); } @@ -258,6 +274,9 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_reply_channel_range(byte[] their_node_id, ReplyChannelRange msg) { long ret = bindings.RoutingMessageHandler_handle_reply_channel_range(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -271,6 +290,9 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_reply_short_channel_ids_end(byte[] their_node_id, ReplyShortChannelIdsEnd msg) { long ret = bindings.RoutingMessageHandler_handle_reply_short_channel_ids_end(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -282,6 +304,9 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_query_channel_range(byte[] their_node_id, QueryChannelRange msg) { long ret = bindings.RoutingMessageHandler_handle_query_channel_range(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -293,6 +318,9 @@ public class RoutingMessageHandler extends CommonBase { */ public Result_NoneLightningErrorZ handle_query_short_channel_ids(byte[] their_node_id, QueryShortChannelIds msg) { long ret = bindings.RoutingMessageHandler_handle_query_short_channel_ids(this.ptr, InternalUtils.check_arr_len(their_node_id, 33), msg == null ? 0 : msg.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(their_node_id); + Reference.reachabilityFence(msg); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Score.java b/src/main/java/org/ldk/structs/Score.java index 902dc021..3f6f7d1a 100644 --- a/src/main/java/org/ldk/structs/Score.java +++ b/src/main/java/org/ldk/structs/Score.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -27,14 +28,28 @@ public class Score extends CommonBase { public static interface ScoreInterface { /** - * Returns the fee in msats willing to be paid to avoid routing through the given channel - * in the direction from `source` to `target`. + * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the + * given channel in the direction from `source` to `target`. + * + * The channel's capacity (less any other MPP parts which are also being considered for use in + * the same payment) is given by `channel_capacity_msat`. It may be guessed from various + * sources or assumed from no data at all. + * + * For hints provided in the invoice, we assume the channel has sufficient capacity to accept + * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other + * cases it is set to `Some`, even if we're guessing at the channel value. + * + * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC. */ - long channel_penalty_msat(long short_channel_id, NodeId source, NodeId target); + long channel_penalty_msat(long short_channel_id, long send_amt_msat, Option_u64Z channel_capacity_msat, NodeId source, NodeId target); /** * Handles updating channel penalties after failing to route through a channel. */ void payment_path_failed(RouteHop[] path, long short_channel_id); + /** + * Handles updating channel penalties after successfully routing along a path. + */ + void payment_path_successful(RouteHop[] path); /** * Serialize the object into a byte array */ @@ -44,10 +59,12 @@ public class Score extends CommonBase { public static Score new_impl(ScoreInterface arg) { final LDKScoreHolder impl_holder = new LDKScoreHolder(); impl_holder.held = new Score(new bindings.LDKScore() { - @Override public long channel_penalty_msat(long short_channel_id, long source, long target) { + @Override public long channel_penalty_msat(long short_channel_id, long send_amt_msat, long channel_capacity_msat, long source, long target) { + Option_u64Z channel_capacity_msat_hu_conv = Option_u64Z.constr_from_ptr(channel_capacity_msat); + channel_capacity_msat_hu_conv.ptrs_to.add(this); NodeId source_hu_conv = null; if (source < 0 || source > 4096) { source_hu_conv = new NodeId(null, source); } NodeId target_hu_conv = null; if (target < 0 || target > 4096) { target_hu_conv = new NodeId(null, target); } - long ret = arg.channel_penalty_msat(short_channel_id, source_hu_conv, target_hu_conv); + long ret = arg.channel_penalty_msat(short_channel_id, send_amt_msat, channel_capacity_msat_hu_conv, source_hu_conv, target_hu_conv); return ret; } @Override public void payment_path_failed(long[] path, long short_channel_id) { @@ -60,6 +77,16 @@ public class Score extends CommonBase { } arg.payment_path_failed(path_conv_10_arr, short_channel_id); } + @Override public void payment_path_successful(long[] path) { + RouteHop[] path_conv_10_arr = new RouteHop[path.length]; + for (int k = 0; k < path.length; k++) { + long path_conv_10 = path[k]; + RouteHop path_conv_10_hu_conv = null; if (path_conv_10 < 0 || path_conv_10 > 4096) { path_conv_10_hu_conv = new RouteHop(null, path_conv_10); } + path_conv_10_hu_conv.ptrs_to.add(this); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + arg.payment_path_successful(path_conv_10_arr); + } @Override public byte[] write() { byte[] ret = arg.write(); return ret; @@ -68,11 +95,27 @@ public class Score extends CommonBase { return impl_holder.held; } /** - * Returns the fee in msats willing to be paid to avoid routing through the given channel - * in the direction from `source` to `target`. + * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the + * given channel in the direction from `source` to `target`. + * + * The channel's capacity (less any other MPP parts which are also being considered for use in + * the same payment) is given by `channel_capacity_msat`. It may be guessed from various + * sources or assumed from no data at all. + * + * For hints provided in the invoice, we assume the channel has sufficient capacity to accept + * the invoice's full amount, and provide a `channel_capacity_msat` of `None`. In all other + * cases it is set to `Some`, even if we're guessing at the channel value. + * + * Your code should be overflow-safe through a `channel_capacity_msat` of 21 million BTC. */ - public long channel_penalty_msat(long short_channel_id, NodeId source, NodeId target) { - long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1); + public long channel_penalty_msat(long short_channel_id, long send_amt_msat, Option_u64Z channel_capacity_msat, NodeId source, NodeId target) { + long ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, send_amt_msat, channel_capacity_msat.ptr, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(short_channel_id); + Reference.reachabilityFence(send_amt_msat); + Reference.reachabilityFence(channel_capacity_msat); + Reference.reachabilityFence(source); + Reference.reachabilityFence(target); this.ptrs_to.add(source); this.ptrs_to.add(target); return ret; @@ -83,6 +126,18 @@ public class Score extends CommonBase { */ public void payment_path_failed(RouteHop[] path, long short_channel_id) { bindings.Score_payment_path_failed(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null, short_channel_id); + Reference.reachabilityFence(this); + Reference.reachabilityFence(path); + Reference.reachabilityFence(short_channel_id); + } + + /** + * Handles updating channel penalties after successfully routing along a path. + */ + public void payment_path_successful(RouteHop[] path) { + bindings.Score_payment_path_successful(this.ptr, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(path); } /** @@ -90,6 +145,7 @@ public class Score extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Score_write(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/Scorer.java b/src/main/java/org/ldk/structs/Scorer.java index 82b99579..0bd74183 100644 --- a/src/main/java/org/ldk/structs/Scorer.java +++ b/src/main/java/org/ldk/structs/Scorer.java @@ -4,18 +4,19 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** - * [`routing::Score`] implementation that provides reasonable default behavior. + * [`Score`] implementation that provides reasonable default behavior. * * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with * slightly higher fees are available. Will further penalize channels that fail to relay payments. * * See [module-level documentation] for usage. * - * [module-level documentation]: crate::routing::scorer + * [module-level documentation]: crate::routing::scoring */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays public class Scorer extends CommonBase { @@ -29,8 +30,13 @@ public class Scorer extends CommonBase { /** * Creates a new scorer using the given scoring parameters. */ - public static Scorer of(long params_base_penalty_msat_arg, long params_failure_penalty_msat_arg, long params_failure_penalty_half_life_arg) { - long ret = bindings.Scorer_new(bindings.ScoringParameters_new(params_base_penalty_msat_arg, params_failure_penalty_msat_arg, params_failure_penalty_half_life_arg)); + public static Scorer of(long params_base_penalty_msat_arg, long params_failure_penalty_msat_arg, short params_overuse_penalty_start_1024th_arg, long params_overuse_penalty_msat_per_1024th_arg, long params_failure_penalty_half_life_arg) { + long ret = bindings.Scorer_new(bindings.ScoringParameters_new(params_base_penalty_msat_arg, params_failure_penalty_msat_arg, params_overuse_penalty_start_1024th_arg, params_overuse_penalty_msat_per_1024th_arg, params_failure_penalty_half_life_arg)); + Reference.reachabilityFence(params_base_penalty_msat_arg); + Reference.reachabilityFence(params_failure_penalty_msat_arg); + Reference.reachabilityFence(params_overuse_penalty_start_1024th_arg); + Reference.reachabilityFence(params_overuse_penalty_msat_per_1024th_arg); + Reference.reachabilityFence(params_failure_penalty_half_life_arg); if (ret >= 0 && ret <= 4096) { return null; } Scorer ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Scorer(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -54,6 +60,7 @@ public class Scorer extends CommonBase { */ public Score as_Score() { long ret = bindings.Scorer_as_Score(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Score ret_hu_conv = new Score(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -65,6 +72,7 @@ public class Scorer extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Scorer_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +81,7 @@ public class Scorer extends CommonBase { */ public static Result_ScorerDecodeErrorZ read(byte[] ser) { long ret = bindings.Scorer_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ScorerDecodeErrorZ ret_hu_conv = Result_ScorerDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ScoringParameters.java b/src/main/java/org/ldk/structs/ScoringParameters.java index eccd438a..d0360a5b 100644 --- a/src/main/java/org/ldk/structs/ScoringParameters.java +++ b/src/main/java/org/ldk/structs/ScoringParameters.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,29 +22,39 @@ public class ScoringParameters extends CommonBase { /** * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat */ public long get_base_penalty_msat() { long ret = bindings.ScoringParameters_get_base_penalty_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } /** * A fixed penalty in msats to apply to each channel. + * + * Default value: 500 msat */ public void set_base_penalty_msat(long val) { bindings.ScoringParameters_set_base_penalty_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * A penalty in msats to apply to a channel upon failing to relay a payment. * * This accumulates for each failure but may be reduced over time based on - * [`failure_penalty_half_life`]. + * [`failure_penalty_half_life`] or when successfully routing through a channel. + * + * Default value: 1,024,000 msat * * [`failure_penalty_half_life`]: Self::failure_penalty_half_life */ public long get_failure_penalty_msat() { long ret = bindings.ScoringParameters_get_failure_penalty_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -51,27 +62,92 @@ public class ScoringParameters extends CommonBase { * A penalty in msats to apply to a channel upon failing to relay a payment. * * This accumulates for each failure but may be reduced over time based on - * [`failure_penalty_half_life`]. + * [`failure_penalty_half_life`] or when successfully routing through a channel. + * + * Default value: 1,024,000 msat * * [`failure_penalty_half_life`]: Self::failure_penalty_half_life */ public void set_failure_penalty_msat(long val) { bindings.ScoringParameters_set_failure_penalty_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * When the amount being sent over a channel is this many 1024ths of the total channel + * capacity, we begin applying [`overuse_penalty_msat_per_1024th`]. + * + * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel) + * + * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th + */ + public short get_overuse_penalty_start_1024th() { + short ret = bindings.ScoringParameters_get_overuse_penalty_start_1024th(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * When the amount being sent over a channel is this many 1024ths of the total channel + * capacity, we begin applying [`overuse_penalty_msat_per_1024th`]. + * + * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel) + * + * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th + */ + public void set_overuse_penalty_start_1024th(short val) { + bindings.ScoringParameters_set_overuse_penalty_start_1024th(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent + * over the channel exceeds [`overuse_penalty_start_1024th`] by. + * + * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty + * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel) + * + * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th + */ + public long get_overuse_penalty_msat_per_1024th() { + long ret = bindings.ScoringParameters_get_overuse_penalty_msat_per_1024th(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent + * over the channel exceeds [`overuse_penalty_start_1024th`] by. + * + * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty + * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel) + * + * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th + */ + public void set_overuse_penalty_msat_per_1024th(long val) { + bindings.ScoringParameters_set_overuse_penalty_msat_per_1024th(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are * cut in half. * + * Successfully routing through a channel will immediately cut the penalty in half as well. + * * # Note * - * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never - * elapse. Therefore, this penalty will never decay. + * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will + * never decay. * * [`failure_penalty_msat`]: Self::failure_penalty_msat */ public long get_failure_penalty_half_life() { long ret = bindings.ScoringParameters_get_failure_penalty_half_life(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -79,22 +155,31 @@ public class ScoringParameters extends CommonBase { * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are * cut in half. * + * Successfully routing through a channel will immediately cut the penalty in half as well. + * * # Note * - * When time is an [`Eternity`], as is default when enabling feature `no-std`, it will never - * elapse. Therefore, this penalty will never decay. + * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will + * never decay. * * [`failure_penalty_msat`]: Self::failure_penalty_msat */ public void set_failure_penalty_half_life(long val) { bindings.ScoringParameters_set_failure_penalty_half_life(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * Constructs a new ScoringParameters given each field */ - public static ScoringParameters of(long base_penalty_msat_arg, long failure_penalty_msat_arg, long failure_penalty_half_life_arg) { - long ret = bindings.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); + public static ScoringParameters of(long base_penalty_msat_arg, long failure_penalty_msat_arg, short overuse_penalty_start_1024th_arg, long overuse_penalty_msat_per_1024th_arg, long failure_penalty_half_life_arg) { + long ret = bindings.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); + Reference.reachabilityFence(base_penalty_msat_arg); + Reference.reachabilityFence(failure_penalty_msat_arg); + Reference.reachabilityFence(overuse_penalty_start_1024th_arg); + Reference.reachabilityFence(overuse_penalty_msat_per_1024th_arg); + Reference.reachabilityFence(failure_penalty_half_life_arg); if (ret >= 0 && ret <= 4096) { return null; } ScoringParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ScoringParameters(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -106,6 +191,7 @@ public class ScoringParameters extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ScoringParameters_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -114,6 +200,7 @@ public class ScoringParameters extends CommonBase { */ public static Result_ScoringParametersDecodeErrorZ read(byte[] ser) { long ret = bindings.ScoringParameters_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/Sha256.java b/src/main/java/org/ldk/structs/Sha256.java index 011cd861..58497f1d 100644 --- a/src/main/java/org/ldk/structs/Sha256.java +++ b/src/main/java/org/ldk/structs/Sha256.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -21,6 +22,7 @@ public class Sha256 extends CommonBase { long clone_ptr() { long ret = bindings.Sha256_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -29,6 +31,7 @@ public class Sha256 extends CommonBase { */ public Sha256 clone() { long ret = bindings.Sha256_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Sha256 ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Sha256(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,9 +43,13 @@ public class Sha256 extends CommonBase { */ public long hash() { long ret = bindings.Sha256_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } /** * Checks if two Sha256s contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -50,8 +57,14 @@ public class Sha256 extends CommonBase { */ public boolean eq(Sha256 b) { boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof Sha256)) return false; + return this.eq((Sha256)o); + } } diff --git a/src/main/java/org/ldk/structs/Shutdown.java b/src/main/java/org/ldk/structs/Shutdown.java index 7238ff97..2245c11b 100644 --- a/src/main/java/org/ldk/structs/Shutdown.java +++ b/src/main/java/org/ldk/structs/Shutdown.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class Shutdown extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.Shutdown_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class Shutdown extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.Shutdown_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -40,6 +44,7 @@ public class Shutdown extends CommonBase { */ public byte[] get_scriptpubkey() { byte[] ret = bindings.Shutdown_get_scriptpubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +54,8 @@ public class Shutdown extends CommonBase { */ public void set_scriptpubkey(byte[] val) { bindings.Shutdown_set_scriptpubkey(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -56,6 +63,8 @@ public class Shutdown extends CommonBase { */ public static Shutdown of(byte[] channel_id_arg, byte[] scriptpubkey_arg) { long ret = bindings.Shutdown_new(InternalUtils.check_arr_len(channel_id_arg, 32), scriptpubkey_arg); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(scriptpubkey_arg); if (ret >= 0 && ret <= 4096) { return null; } Shutdown ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Shutdown(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -64,6 +73,7 @@ public class Shutdown extends CommonBase { long clone_ptr() { long ret = bindings.Shutdown_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -72,6 +82,7 @@ public class Shutdown extends CommonBase { */ public Shutdown clone() { long ret = bindings.Shutdown_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Shutdown ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new Shutdown(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -83,6 +94,7 @@ public class Shutdown extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Shutdown_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -91,6 +103,7 @@ public class Shutdown extends CommonBase { */ public static Result_ShutdownDecodeErrorZ read(byte[] ser) { long ret = bindings.Shutdown_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownDecodeErrorZ ret_hu_conv = Result_ShutdownDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ShutdownScript.java b/src/main/java/org/ldk/structs/ShutdownScript.java index f60f0c25..f180526c 100644 --- a/src/main/java/org/ldk/structs/ShutdownScript.java +++ b/src/main/java/org/ldk/structs/ShutdownScript.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -23,6 +24,7 @@ public class ShutdownScript extends CommonBase { long clone_ptr() { long ret = bindings.ShutdownScript_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -31,6 +33,7 @@ public class ShutdownScript extends CommonBase { */ public ShutdownScript clone() { long ret = bindings.ShutdownScript_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ShutdownScript(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -42,6 +45,7 @@ public class ShutdownScript extends CommonBase { */ public byte[] write() { byte[] ret = bindings.ShutdownScript_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +54,7 @@ public class ShutdownScript extends CommonBase { */ public static Result_ShutdownScriptDecodeErrorZ read(byte[] ser) { long ret = bindings.ShutdownScript_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptDecodeErrorZ ret_hu_conv = Result_ShutdownScriptDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -60,6 +65,7 @@ public class ShutdownScript extends CommonBase { */ public static ShutdownScript new_p2wpkh(byte[] pubkey_hash) { long ret = bindings.ShutdownScript_new_p2wpkh(InternalUtils.check_arr_len(pubkey_hash, 20)); + Reference.reachabilityFence(pubkey_hash); if (ret >= 0 && ret <= 4096) { return null; } ShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ShutdownScript(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -71,6 +77,7 @@ public class ShutdownScript extends CommonBase { */ public static ShutdownScript new_p2wsh(byte[] script_hash) { long ret = bindings.ShutdownScript_new_p2wsh(InternalUtils.check_arr_len(script_hash, 32)); + Reference.reachabilityFence(script_hash); if (ret >= 0 && ret <= 4096) { return null; } ShutdownScript ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ShutdownScript(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -89,6 +96,8 @@ public class ShutdownScript extends CommonBase { */ public static Result_ShutdownScriptInvalidShutdownScriptZ new_witness_program(byte version, byte[] program) { long ret = bindings.ShutdownScript_new_witness_program(version, program); + Reference.reachabilityFence(version); + Reference.reachabilityFence(program); if (ret >= 0 && ret <= 4096) { return null; } Result_ShutdownScriptInvalidShutdownScriptZ ret_hu_conv = Result_ShutdownScriptInvalidShutdownScriptZ.constr_from_ptr(ret); return ret_hu_conv; @@ -99,6 +108,7 @@ public class ShutdownScript extends CommonBase { */ public byte[] into_inner() { byte[] ret = bindings.ShutdownScript_into_inner(this.ptr); + Reference.reachabilityFence(this); ; return ret; } @@ -111,6 +121,7 @@ public class ShutdownScript extends CommonBase { @Nullable public byte[] as_legacy_pubkey() { byte[] ret = bindings.ShutdownScript_as_legacy_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -121,6 +132,8 @@ public class ShutdownScript extends CommonBase { */ public boolean is_compatible(InitFeatures features) { boolean ret = bindings.ShutdownScript_is_compatible(this.ptr, features == null ? 0 : features.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(features); this.ptrs_to.add(features); return ret; } diff --git a/src/main/java/org/ldk/structs/Sign.java b/src/main/java/org/ldk/structs/Sign.java index 57277357..aea1d41e 100644 --- a/src/main/java/org/ldk/structs/Sign.java +++ b/src/main/java/org/ldk/structs/Sign.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -60,11 +61,13 @@ public class Sign extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Sign_write(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.Sign_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -73,6 +76,7 @@ public class Sign extends CommonBase { */ public Sign clone() { long ret = bindings.Sign_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Sign ret_hu_conv = new Sign(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/SignOrCreationError.java b/src/main/java/org/ldk/structs/SignOrCreationError.java index 8bc1550f..7d1eddbb 100644 --- a/src/main/java/org/ldk/structs/SignOrCreationError.java +++ b/src/main/java/org/ldk/structs/SignOrCreationError.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -50,6 +51,7 @@ public class SignOrCreationError extends CommonBase { } long clone_ptr() { long ret = bindings.SignOrCreationError_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -58,6 +60,7 @@ public class SignOrCreationError extends CommonBase { */ public SignOrCreationError clone() { long ret = bindings.SignOrCreationError_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -80,6 +83,7 @@ public class SignOrCreationError extends CommonBase { */ public static SignOrCreationError creation_error(org.ldk.enums.CreationError a) { long ret = bindings.SignOrCreationError_creation_error(a); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } SignOrCreationError ret_hu_conv = SignOrCreationError.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -92,14 +96,21 @@ public class SignOrCreationError extends CommonBase { */ public boolean eq(SignOrCreationError b) { boolean ret = bindings.SignOrCreationError_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof SignOrCreationError)) return false; + return this.eq((SignOrCreationError)o); + } /** * Get the string representation of a SignOrCreationError object */ public String to_str() { String ret = bindings.SignOrCreationError_to_str(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/SignedRawInvoice.java b/src/main/java/org/ldk/structs/SignedRawInvoice.java index f9fd6c3d..d214d549 100644 --- a/src/main/java/org/ldk/structs/SignedRawInvoice.java +++ b/src/main/java/org/ldk/structs/SignedRawInvoice.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -30,12 +31,19 @@ public class SignedRawInvoice extends CommonBase { */ public boolean eq(SignedRawInvoice b) { boolean ret = bindings.SignedRawInvoice_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(b); this.ptrs_to.add(b); return ret; } + @Override public boolean equals(Object o) { + if (!(o instanceof SignedRawInvoice)) return false; + return this.eq((SignedRawInvoice)o); + } long clone_ptr() { long ret = bindings.SignedRawInvoice_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -44,6 +52,7 @@ public class SignedRawInvoice extends CommonBase { */ public SignedRawInvoice clone() { long ret = bindings.SignedRawInvoice_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } SignedRawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new SignedRawInvoice(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -58,6 +67,7 @@ public class SignedRawInvoice extends CommonBase { */ public ThreeTuple_RawInvoice_u832InvoiceSignatureZ into_parts() { long ret = bindings.SignedRawInvoice_into_parts(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ThreeTuple_RawInvoice_u832InvoiceSignatureZ ret_hu_conv = new ThreeTuple_RawInvoice_u832InvoiceSignatureZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -70,6 +80,7 @@ public class SignedRawInvoice extends CommonBase { */ public RawInvoice raw_invoice() { long ret = bindings.SignedRawInvoice_raw_invoice(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawInvoice(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -81,6 +92,7 @@ public class SignedRawInvoice extends CommonBase { */ public byte[] hash() { byte[] ret = bindings.SignedRawInvoice_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -89,6 +101,7 @@ public class SignedRawInvoice extends CommonBase { */ public InvoiceSignature signature() { long ret = bindings.SignedRawInvoice_signature(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceSignature ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceSignature(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -100,6 +113,7 @@ public class SignedRawInvoice extends CommonBase { */ public Result_PayeePubKeyErrorZ recover_payee_pub_key() { long ret = bindings.SignedRawInvoice_recover_payee_pub_key(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Result_PayeePubKeyErrorZ ret_hu_conv = Result_PayeePubKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -111,6 +125,7 @@ public class SignedRawInvoice extends CommonBase { */ public boolean check_signature() { boolean ret = bindings.SignedRawInvoice_check_signature(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -119,6 +134,7 @@ public class SignedRawInvoice extends CommonBase { */ public static Result_SignedRawInvoiceNoneZ from_str(java.lang.String s) { long ret = bindings.SignedRawInvoice_from_str(s); + Reference.reachabilityFence(s); if (ret >= 0 && ret <= 4096) { return null; } Result_SignedRawInvoiceNoneZ ret_hu_conv = Result_SignedRawInvoiceNoneZ.constr_from_ptr(ret); return ret_hu_conv; @@ -129,6 +145,7 @@ public class SignedRawInvoice extends CommonBase { */ public String to_str() { String ret = bindings.SignedRawInvoice_to_str(this.ptr); + Reference.reachabilityFence(this); return ret; } diff --git a/src/main/java/org/ldk/structs/SocketDescriptor.java b/src/main/java/org/ldk/structs/SocketDescriptor.java index 3edbde56..93e47ca4 100644 --- a/src/main/java/org/ldk/structs/SocketDescriptor.java +++ b/src/main/java/org/ldk/structs/SocketDescriptor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -117,6 +118,9 @@ public class SocketDescriptor extends CommonBase { */ public long send_data(byte[] data, boolean resume_read) { long ret = bindings.SocketDescriptor_send_data(this.ptr, data, resume_read); + Reference.reachabilityFence(this); + Reference.reachabilityFence(data); + Reference.reachabilityFence(resume_read); return ret; } @@ -128,6 +132,7 @@ public class SocketDescriptor extends CommonBase { */ public void disconnect_socket() { bindings.SocketDescriptor_disconnect_socket(this.ptr); + Reference.reachabilityFence(this); } /** @@ -136,11 +141,16 @@ public class SocketDescriptor extends CommonBase { */ public long hash() { long ret = bindings.SocketDescriptor_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } long clone_ptr() { long ret = bindings.SocketDescriptor_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -149,6 +159,7 @@ public class SocketDescriptor extends CommonBase { */ public SocketDescriptor clone() { long ret = bindings.SocketDescriptor_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } SocketDescriptor ret_hu_conv = new SocketDescriptor(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java index 34ff18ac..d07fb081 100644 --- a/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/SpendableOutputDescriptor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -124,6 +125,7 @@ public class SpendableOutputDescriptor extends CommonBase { } long clone_ptr() { long ret = bindings.SpendableOutputDescriptor_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -132,6 +134,7 @@ public class SpendableOutputDescriptor extends CommonBase { */ public SpendableOutputDescriptor clone() { long ret = bindings.SpendableOutputDescriptor_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); @@ -143,6 +146,8 @@ public class SpendableOutputDescriptor extends CommonBase { */ public static SpendableOutputDescriptor static_output(OutPoint outpoint, TxOut output) { long ret = bindings.SpendableOutputDescriptor_static_output(outpoint == null ? 0 : outpoint.ptr & ~1, output.ptr); + Reference.reachabilityFence(outpoint); + Reference.reachabilityFence(output); if (ret >= 0 && ret <= 4096) { return null; } SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -154,6 +159,7 @@ public class SpendableOutputDescriptor extends CommonBase { */ public static SpendableOutputDescriptor delayed_payment_output(DelayedPaymentOutputDescriptor a) { long ret = bindings.SpendableOutputDescriptor_delayed_payment_output(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -165,6 +171,7 @@ public class SpendableOutputDescriptor extends CommonBase { */ public static SpendableOutputDescriptor static_payment_output(StaticPaymentOutputDescriptor a) { long ret = bindings.SpendableOutputDescriptor_static_payment_output(a == null ? 0 : a.ptr & ~1); + Reference.reachabilityFence(a); if (ret >= 0 && ret <= 4096) { return null; } SpendableOutputDescriptor ret_hu_conv = SpendableOutputDescriptor.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -176,6 +183,7 @@ public class SpendableOutputDescriptor extends CommonBase { */ public byte[] write() { byte[] ret = bindings.SpendableOutputDescriptor_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -184,6 +192,7 @@ public class SpendableOutputDescriptor extends CommonBase { */ public static Result_SpendableOutputDescriptorDecodeErrorZ read(byte[] ser) { long ret = bindings.SpendableOutputDescriptor_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_SpendableOutputDescriptorDecodeErrorZ ret_hu_conv = Result_SpendableOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java b/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java index 7fcb906e..e8dfdfa2 100644 --- a/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java +++ b/src/main/java/org/ldk/structs/StaticPaymentOutputDescriptor.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -25,6 +26,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public OutPoint get_outpoint() { long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -36,6 +38,8 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public void set_outpoint(OutPoint val) { bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -43,6 +47,8 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public void set_output(TxOut val) { bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -52,6 +58,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public byte[] get_channel_keys_id() { byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +69,8 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public void set_channel_keys_id(byte[] val) { bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +78,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public long get_channel_value_satoshis() { long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +87,8 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public void set_channel_value_satoshis(long val) { bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +96,10 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public static StaticPaymentOutputDescriptor of(OutPoint outpoint_arg, TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) { long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, output_arg.ptr, InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg); + Reference.reachabilityFence(outpoint_arg); + Reference.reachabilityFence(output_arg); + Reference.reachabilityFence(channel_keys_id_arg); + Reference.reachabilityFence(channel_value_satoshis_arg); if (ret >= 0 && ret <= 4096) { return null; } StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -92,6 +108,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { long clone_ptr() { long ret = bindings.StaticPaymentOutputDescriptor_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -100,6 +117,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public StaticPaymentOutputDescriptor clone() { long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -111,6 +129,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public byte[] write() { byte[] ret = bindings.StaticPaymentOutputDescriptor_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -119,6 +138,7 @@ public class StaticPaymentOutputDescriptor extends CommonBase { */ public static Result_StaticPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) { long ret = bindings.StaticPaymentOutputDescriptor_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.java b/src/main/java/org/ldk/structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.java index ffc06129..d0fa79c9 100644 --- a/src/main/java/org/ldk/structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.java +++ b/src/main/java/org/ldk/structs/ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ extends C */ public ChannelAnnouncement get_a() { long ret = bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_a(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,7 @@ public class ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ extends C */ public ChannelUpdate get_b() { long ret = bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_b(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -46,6 +49,7 @@ public class ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ extends C */ public ChannelUpdate get_c() { long ret = bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -54,6 +58,7 @@ public class ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ extends C long clone_ptr() { long ret = bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -63,6 +68,7 @@ public class ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ extends C */ public ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ clone() { long ret = bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_hu_conv = new ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -74,6 +80,9 @@ public class ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ extends C */ public static ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ of(ChannelAnnouncement a, ChannelUpdate b, ChannelUpdate c) { long ret = bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a == null ? 0 : a.ptr & ~1, b == null ? 0 : b.ptr & ~1, c == null ? 0 : c.ptr & ~1); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + Reference.reachabilityFence(c); if (ret >= 0 && ret <= 4096) { return null; } ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ ret_hu_conv = new ThreeTuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.java b/src/main/java/org/ldk/structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.java index 41931460..496c1ac0 100644 --- a/src/main/java/org/ldk/structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.java +++ b/src/main/java/org/ldk/structs/ThreeTuple_RawInvoice_u832InvoiceSignatureZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class ThreeTuple_RawInvoice_u832InvoiceSignatureZ extends CommonBase { */ public RawInvoice get_a() { long ret = bindings.C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_a(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } RawInvoice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new RawInvoice(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,7 @@ public class ThreeTuple_RawInvoice_u832InvoiceSignatureZ extends CommonBase { */ public byte[] get_b() { byte[] ret = bindings.C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -43,6 +46,7 @@ public class ThreeTuple_RawInvoice_u832InvoiceSignatureZ extends CommonBase { */ public InvoiceSignature get_c() { long ret = bindings.C3Tuple_RawInvoice_u832InvoiceSignatureZ_get_c(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } InvoiceSignature ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new InvoiceSignature(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -51,6 +55,7 @@ public class ThreeTuple_RawInvoice_u832InvoiceSignatureZ extends CommonBase { long clone_ptr() { long ret = bindings.C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -60,6 +65,7 @@ public class ThreeTuple_RawInvoice_u832InvoiceSignatureZ extends CommonBase { */ public ThreeTuple_RawInvoice_u832InvoiceSignatureZ clone() { long ret = bindings.C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ThreeTuple_RawInvoice_u832InvoiceSignatureZ ret_hu_conv = new ThreeTuple_RawInvoice_u832InvoiceSignatureZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -71,6 +77,9 @@ public class ThreeTuple_RawInvoice_u832InvoiceSignatureZ extends CommonBase { */ public static ThreeTuple_RawInvoice_u832InvoiceSignatureZ of(RawInvoice a, byte[] b, InvoiceSignature c) { long ret = bindings.C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a == null ? 0 : a.ptr & ~1, InternalUtils.check_arr_len(b, 32), c == null ? 0 : c.ptr & ~1); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); + Reference.reachabilityFence(c); if (ret >= 0 && ret <= 4096) { return null; } ThreeTuple_RawInvoice_u832InvoiceSignatureZ ret_hu_conv = new ThreeTuple_RawInvoice_u832InvoiceSignatureZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TrustedClosingTransaction.java b/src/main/java/org/ldk/structs/TrustedClosingTransaction.java index 65fca265..569c7140 100644 --- a/src/main/java/org/ldk/structs/TrustedClosingTransaction.java +++ b/src/main/java/org/ldk/structs/TrustedClosingTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -29,6 +30,7 @@ public class TrustedClosingTransaction extends CommonBase { */ public byte[] built_transaction() { byte[] ret = bindings.TrustedClosingTransaction_built_transaction(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -39,6 +41,9 @@ public class TrustedClosingTransaction extends CommonBase { */ public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) { byte[] ret = bindings.TrustedClosingTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_redeemscript); + Reference.reachabilityFence(channel_value_satoshis); return ret; } @@ -48,6 +53,10 @@ public class TrustedClosingTransaction extends CommonBase { */ public byte[] sign(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) { byte[] ret = bindings.TrustedClosingTransaction_sign(this.ptr, InternalUtils.check_arr_len(funding_key, 32), funding_redeemscript, channel_value_satoshis); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_key); + Reference.reachabilityFence(funding_redeemscript); + Reference.reachabilityFence(channel_value_satoshis); return ret; } diff --git a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java index b282b7a9..1590d438 100644 --- a/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java +++ b/src/main/java/org/ldk/structs/TrustedCommitmentTransaction.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -29,6 +30,7 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public byte[] txid() { byte[] ret = bindings.TrustedCommitmentTransaction_txid(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -37,6 +39,7 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public BuiltCommitmentTransaction built_transaction() { long ret = bindings.TrustedCommitmentTransaction_built_transaction(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } BuiltCommitmentTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new BuiltCommitmentTransaction(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -48,12 +51,22 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public TxCreationKeys keys() { long ret = bindings.TrustedCommitmentTransaction_keys(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TxCreationKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TxCreationKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } + /** + * Should anchors be used. + */ + public boolean opt_anchors() { + boolean ret = bindings.TrustedCommitmentTransaction_opt_anchors(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Get a signature for each HTLC which was included in the commitment transaction (ie for * which HTLCOutputInCommitment::transaction_output_index.is_some()). @@ -62,6 +75,9 @@ public class TrustedCommitmentTransaction extends CommonBase { */ public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, DirectedChannelTransactionParameters channel_parameters) { long ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(htlc_base_key); + Reference.reachabilityFence(channel_parameters); if (ret >= 0 && ret <= 4096) { return null; } Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); this.ptrs_to.add(channel_parameters); diff --git a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java index 8a560051..41a818c7 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelManagerZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_BlockHashChannelManagerZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_BlockHashChannelManagerZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class TwoTuple_BlockHashChannelManagerZ extends CommonBase { */ public ChannelManager get_b() { long ret = bindings.C2Tuple_BlockHashChannelManagerZ_get_b(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelManager ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelManager(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -43,6 +46,14 @@ public class TwoTuple_BlockHashChannelManagerZ extends CommonBase { */ public static TwoTuple_BlockHashChannelManagerZ of(byte[] a, FeeEstimator b_fee_est, Watch b_chain_monitor, BroadcasterInterface b_tx_broadcaster, Logger b_logger, KeysInterface b_keys_manager, UserConfig b_config, ChainParameters b_params) { long ret = bindings.C2Tuple_BlockHashChannelManagerZ_new(InternalUtils.check_arr_len(a, 32), bindings.ChannelManager_new(b_fee_est == null ? 0 : b_fee_est.ptr, b_chain_monitor == null ? 0 : b_chain_monitor.ptr, b_tx_broadcaster == null ? 0 : b_tx_broadcaster.ptr, b_logger == null ? 0 : b_logger.ptr, b_keys_manager == null ? 0 : b_keys_manager.ptr, b_config == null ? 0 : b_config.ptr & ~1, b_params == null ? 0 : b_params.ptr & ~1)); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b_fee_est); + Reference.reachabilityFence(b_chain_monitor); + Reference.reachabilityFence(b_tx_broadcaster); + Reference.reachabilityFence(b_logger); + Reference.reachabilityFence(b_keys_manager); + Reference.reachabilityFence(b_config); + Reference.reachabilityFence(b_params); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_BlockHashChannelManagerZ ret_hu_conv = new TwoTuple_BlockHashChannelManagerZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelMonitorZ.java b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelMonitorZ.java index 4cedf1ff..1d67dbb8 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelMonitorZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_BlockHashChannelMonitorZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_BlockHashChannelMonitorZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_BlockHashChannelMonitorZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class TwoTuple_BlockHashChannelMonitorZ extends CommonBase { */ public ChannelMonitor get_b() { long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_get_b(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelMonitor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelMonitor(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -40,6 +43,7 @@ public class TwoTuple_BlockHashChannelMonitorZ extends CommonBase { long clone_ptr() { long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +53,7 @@ public class TwoTuple_BlockHashChannelMonitorZ extends CommonBase { */ public TwoTuple_BlockHashChannelMonitorZ clone() { long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_BlockHashChannelMonitorZ ret_hu_conv = new TwoTuple_BlockHashChannelMonitorZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -60,6 +65,8 @@ public class TwoTuple_BlockHashChannelMonitorZ extends CommonBase { */ public static TwoTuple_BlockHashChannelMonitorZ of(byte[] a, ChannelMonitor b) { long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_new(InternalUtils.check_arr_len(a, 32), b == null ? 0 : b.ptr & ~1); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_BlockHashChannelMonitorZ ret_hu_conv = new TwoTuple_BlockHashChannelMonitorZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_OutPointScriptZ.java b/src/main/java/org/ldk/structs/TwoTuple_OutPointScriptZ.java index 2cb31e27..28bde7bb 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_OutPointScriptZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_OutPointScriptZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_OutPointScriptZ extends CommonBase { */ public OutPoint get_a() { long ret = bindings.C2Tuple_OutPointScriptZ_get_a(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,11 +37,13 @@ public class TwoTuple_OutPointScriptZ extends CommonBase { */ public byte[] get_b() { byte[] ret = bindings.C2Tuple_OutPointScriptZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.C2Tuple_OutPointScriptZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +53,7 @@ public class TwoTuple_OutPointScriptZ extends CommonBase { */ public TwoTuple_OutPointScriptZ clone() { long ret = bindings.C2Tuple_OutPointScriptZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_OutPointScriptZ ret_hu_conv = new TwoTuple_OutPointScriptZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -60,6 +65,8 @@ public class TwoTuple_OutPointScriptZ extends CommonBase { */ public static TwoTuple_OutPointScriptZ of(OutPoint a, byte[] b) { long ret = bindings.C2Tuple_OutPointScriptZ_new(a == null ? 0 : a.ptr & ~1, b); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_OutPointScriptZ ret_hu_conv = new TwoTuple_OutPointScriptZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java b/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java index 2f8a8dd8..0f95e543 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentIdZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_PaymentHashPaymentIdZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_PaymentHashPaymentIdZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,11 +34,13 @@ public class TwoTuple_PaymentHashPaymentIdZ extends CommonBase { */ public byte[] get_b() { byte[] ret = bindings.C2Tuple_PaymentHashPaymentIdZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.C2Tuple_PaymentHashPaymentIdZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -46,6 +50,7 @@ public class TwoTuple_PaymentHashPaymentIdZ extends CommonBase { */ public TwoTuple_PaymentHashPaymentIdZ clone() { long ret = bindings.C2Tuple_PaymentHashPaymentIdZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_PaymentHashPaymentIdZ ret_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -57,6 +62,8 @@ public class TwoTuple_PaymentHashPaymentIdZ extends CommonBase { */ public static TwoTuple_PaymentHashPaymentIdZ of(byte[] a, byte[] b) { long ret = bindings.C2Tuple_PaymentHashPaymentIdZ_new(InternalUtils.check_arr_len(a, 32), InternalUtils.check_arr_len(b, 32)); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_PaymentHashPaymentIdZ ret_hu_conv = new TwoTuple_PaymentHashPaymentIdZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentSecretZ.java b/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentSecretZ.java index f443be0e..350ad990 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentSecretZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_PaymentHashPaymentSecretZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_PaymentHashPaymentSecretZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_PaymentHashPaymentSecretZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,11 +34,13 @@ public class TwoTuple_PaymentHashPaymentSecretZ extends CommonBase { */ public byte[] get_b() { byte[] ret = bindings.C2Tuple_PaymentHashPaymentSecretZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.C2Tuple_PaymentHashPaymentSecretZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -46,6 +50,7 @@ public class TwoTuple_PaymentHashPaymentSecretZ extends CommonBase { */ public TwoTuple_PaymentHashPaymentSecretZ clone() { long ret = bindings.C2Tuple_PaymentHashPaymentSecretZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_PaymentHashPaymentSecretZ ret_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -57,6 +62,8 @@ public class TwoTuple_PaymentHashPaymentSecretZ extends CommonBase { */ public static TwoTuple_PaymentHashPaymentSecretZ of(byte[] a, byte[] b) { long ret = bindings.C2Tuple_PaymentHashPaymentSecretZ_new(InternalUtils.check_arr_len(a, 32), InternalUtils.check_arr_len(b, 32)); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_PaymentHashPaymentSecretZ ret_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java b/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java index 780d94ff..69052661 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_PublicKeyTypeZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_PublicKeyTypeZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_PublicKeyTypeZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class TwoTuple_PublicKeyTypeZ extends CommonBase { */ public Type get_b() { long ret = bindings.C2Tuple_PublicKeyTypeZ_get_b(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Type ret_hu_conv = new Type(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -40,6 +43,7 @@ public class TwoTuple_PublicKeyTypeZ extends CommonBase { long clone_ptr() { long ret = bindings.C2Tuple_PublicKeyTypeZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -49,6 +53,7 @@ public class TwoTuple_PublicKeyTypeZ extends CommonBase { */ public TwoTuple_PublicKeyTypeZ clone() { long ret = bindings.C2Tuple_PublicKeyTypeZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_PublicKeyTypeZ ret_hu_conv = new TwoTuple_PublicKeyTypeZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -60,6 +65,8 @@ public class TwoTuple_PublicKeyTypeZ extends CommonBase { */ public static TwoTuple_PublicKeyTypeZ of(byte[] a, Type b) { long ret = bindings.C2Tuple_PublicKeyTypeZ_new(InternalUtils.check_arr_len(a, 33), b == null ? 0 : b.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_PublicKeyTypeZ ret_hu_conv = new TwoTuple_PublicKeyTypeZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_SignatureCVec_SignatureZZ.java b/src/main/java/org/ldk/structs/TwoTuple_SignatureCVec_SignatureZZ.java index 1178bd66..d32656ca 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_SignatureCVec_SignatureZZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_SignatureCVec_SignatureZZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_SignatureCVec_SignatureZZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_SignatureCVec_SignatureZZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,11 +34,13 @@ public class TwoTuple_SignatureCVec_SignatureZZ extends CommonBase { */ public byte[][] get_b() { byte[][] ret = bindings.C2Tuple_SignatureCVec_SignatureZZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.C2Tuple_SignatureCVec_SignatureZZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -46,6 +50,7 @@ public class TwoTuple_SignatureCVec_SignatureZZ extends CommonBase { */ public TwoTuple_SignatureCVec_SignatureZZ clone() { long ret = bindings.C2Tuple_SignatureCVec_SignatureZZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_SignatureCVec_SignatureZZ ret_hu_conv = new TwoTuple_SignatureCVec_SignatureZZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -57,6 +62,8 @@ public class TwoTuple_SignatureCVec_SignatureZZ extends CommonBase { */ public static TwoTuple_SignatureCVec_SignatureZZ of(byte[] a, byte[][] b) { long ret = bindings.C2Tuple_SignatureCVec_SignatureZZ_new(InternalUtils.check_arr_len(a, 64), b != null ? Arrays.stream(b).map(b_conv_8 -> InternalUtils.check_arr_len(b_conv_8, 64)).toArray(byte[][]::new) : null); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_SignatureCVec_SignatureZZ ret_hu_conv = new TwoTuple_SignatureCVec_SignatureZZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ.java b/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ.java index 49fd339b..ad17d828 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ extends CommonBase { */ public TwoTuple_u32ScriptZ[] get_b() { long[] ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_get_b(this.ptr); + Reference.reachabilityFence(this); TwoTuple_u32ScriptZ[] ret_conv_21_arr = new TwoTuple_u32ScriptZ[ret.length]; for (int v = 0; v < ret.length; v++) { long ret_conv_21 = ret[v]; @@ -44,6 +47,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ extends CommonBase { long clone_ptr() { long ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +57,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ extends CommonBase { */ public TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ clone() { long ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ ret_hu_conv = new TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -64,6 +69,8 @@ public class TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ extends CommonBase { */ public static TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ of(byte[] a, TwoTuple_u32ScriptZ[] b) { long ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(InternalUtils.check_arr_len(a, 32), b != null ? Arrays.stream(b).mapToLong(b_conv_21 -> b_conv_21 != null ? b_conv_21.ptr : 0).toArray() : null); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ ret_hu_conv = new TwoTuple_TxidCVec_C2Tuple_u32ScriptZZZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.java b/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.java index b3a0b200..76188073 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ extends CommonBase { */ public byte[] get_a() { byte[] ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ extends CommonBase { */ public TwoTuple_u32TxOutZ[] get_b() { long[] ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(this.ptr); + Reference.reachabilityFence(this); TwoTuple_u32TxOutZ[] ret_conv_20_arr = new TwoTuple_u32TxOutZ[ret.length]; for (int u = 0; u < ret.length; u++) { long ret_conv_20 = ret[u]; @@ -44,6 +47,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ extends CommonBase { long clone_ptr() { long ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -53,6 +57,7 @@ public class TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ extends CommonBase { */ public TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ clone() { long ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ ret_hu_conv = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -64,6 +69,8 @@ public class TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ extends CommonBase { */ public static TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ of(byte[] a, TwoTuple_u32TxOutZ[] b) { long ret = bindings.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(InternalUtils.check_arr_len(a, 32), b != null ? Arrays.stream(b).mapToLong(b_conv_20 -> b_conv_20 != null ? b_conv_20.ptr : 0).toArray() : null); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ ret_hu_conv = new TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_u32ScriptZ.java b/src/main/java/org/ldk/structs/TwoTuple_u32ScriptZ.java index 0579bcec..dd114ae2 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_u32ScriptZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_u32ScriptZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_u32ScriptZ extends CommonBase { */ public int get_a() { int ret = bindings.C2Tuple_u32ScriptZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,11 +34,13 @@ public class TwoTuple_u32ScriptZ extends CommonBase { */ public byte[] get_b() { byte[] ret = bindings.C2Tuple_u32ScriptZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.C2Tuple_u32ScriptZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -46,6 +50,7 @@ public class TwoTuple_u32ScriptZ extends CommonBase { */ public TwoTuple_u32ScriptZ clone() { long ret = bindings.C2Tuple_u32ScriptZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_u32ScriptZ ret_hu_conv = new TwoTuple_u32ScriptZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -57,6 +62,8 @@ public class TwoTuple_u32ScriptZ extends CommonBase { */ public static TwoTuple_u32ScriptZ of(int a, byte[] b) { long ret = bindings.C2Tuple_u32ScriptZ_new(a, b); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_u32ScriptZ ret_hu_conv = new TwoTuple_u32ScriptZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_u32TxOutZ.java b/src/main/java/org/ldk/structs/TwoTuple_u32TxOutZ.java index 5928f428..e395b30a 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_u32TxOutZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_u32TxOutZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_u32TxOutZ extends CommonBase { */ public int get_a() { int ret = bindings.C2Tuple_u32TxOutZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,7 @@ public class TwoTuple_u32TxOutZ extends CommonBase { */ public TxOut get_b() { long ret = bindings.C2Tuple_u32TxOutZ_get_b(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TxOut ret_conv = new TxOut(null, ret); return ret_conv; @@ -39,6 +42,7 @@ public class TwoTuple_u32TxOutZ extends CommonBase { long clone_ptr() { long ret = bindings.C2Tuple_u32TxOutZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -48,6 +52,7 @@ public class TwoTuple_u32TxOutZ extends CommonBase { */ public TwoTuple_u32TxOutZ clone() { long ret = bindings.C2Tuple_u32TxOutZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_u32TxOutZ ret_hu_conv = new TwoTuple_u32TxOutZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -59,6 +64,8 @@ public class TwoTuple_u32TxOutZ extends CommonBase { */ public static TwoTuple_u32TxOutZ of(int a, TxOut b) { long ret = bindings.C2Tuple_u32TxOutZ_new(a, b.ptr); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_u32TxOutZ ret_hu_conv = new TwoTuple_u32TxOutZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TwoTuple_usizeTransactionZ.java b/src/main/java/org/ldk/structs/TwoTuple_usizeTransactionZ.java index 459dfea1..7fd217fa 100644 --- a/src/main/java/org/ldk/structs/TwoTuple_usizeTransactionZ.java +++ b/src/main/java/org/ldk/structs/TwoTuple_usizeTransactionZ.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class TwoTuple_usizeTransactionZ extends CommonBase { */ public long get_a() { long ret = bindings.C2Tuple_usizeTransactionZ_get_a(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,11 +34,13 @@ public class TwoTuple_usizeTransactionZ extends CommonBase { */ public byte[] get_b() { byte[] ret = bindings.C2Tuple_usizeTransactionZ_get_b(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.C2Tuple_usizeTransactionZ_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -46,6 +50,7 @@ public class TwoTuple_usizeTransactionZ extends CommonBase { */ public TwoTuple_usizeTransactionZ clone() { long ret = bindings.C2Tuple_usizeTransactionZ_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_usizeTransactionZ ret_hu_conv = new TwoTuple_usizeTransactionZ(null, ret); ret_hu_conv.ptrs_to.add(this); @@ -57,6 +62,8 @@ public class TwoTuple_usizeTransactionZ extends CommonBase { */ public static TwoTuple_usizeTransactionZ of(long a, byte[] b) { long ret = bindings.C2Tuple_usizeTransactionZ_new(a, b); + Reference.reachabilityFence(a); + Reference.reachabilityFence(b); if (ret >= 0 && ret <= 4096) { return null; } TwoTuple_usizeTransactionZ ret_hu_conv = new TwoTuple_usizeTransactionZ(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); diff --git a/src/main/java/org/ldk/structs/TxCreationKeys.java b/src/main/java/org/ldk/structs/TxCreationKeys.java index f976a6af..f1e78509 100644 --- a/src/main/java/org/ldk/structs/TxCreationKeys.java +++ b/src/main/java/org/ldk/structs/TxCreationKeys.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -34,6 +35,7 @@ public class TxCreationKeys extends CommonBase { */ public byte[] get_per_commitment_point() { byte[] ret = bindings.TxCreationKeys_get_per_commitment_point(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -42,6 +44,8 @@ public class TxCreationKeys extends CommonBase { */ public void set_per_commitment_point(byte[] val) { bindings.TxCreationKeys_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -51,6 +55,7 @@ public class TxCreationKeys extends CommonBase { */ public byte[] get_revocation_key() { byte[] ret = bindings.TxCreationKeys_get_revocation_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -61,6 +66,8 @@ public class TxCreationKeys extends CommonBase { */ public void set_revocation_key(byte[] val) { bindings.TxCreationKeys_set_revocation_key(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -68,6 +75,7 @@ public class TxCreationKeys extends CommonBase { */ public byte[] get_broadcaster_htlc_key() { byte[] ret = bindings.TxCreationKeys_get_broadcaster_htlc_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -76,6 +84,8 @@ public class TxCreationKeys extends CommonBase { */ public void set_broadcaster_htlc_key(byte[] val) { bindings.TxCreationKeys_set_broadcaster_htlc_key(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -83,6 +93,7 @@ public class TxCreationKeys extends CommonBase { */ public byte[] get_countersignatory_htlc_key() { byte[] ret = bindings.TxCreationKeys_get_countersignatory_htlc_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -91,6 +102,8 @@ public class TxCreationKeys extends CommonBase { */ public void set_countersignatory_htlc_key(byte[] val) { bindings.TxCreationKeys_set_countersignatory_htlc_key(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -98,6 +111,7 @@ public class TxCreationKeys extends CommonBase { */ public byte[] get_broadcaster_delayed_payment_key() { byte[] ret = bindings.TxCreationKeys_get_broadcaster_delayed_payment_key(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -106,6 +120,8 @@ public class TxCreationKeys extends CommonBase { */ public void set_broadcaster_delayed_payment_key(byte[] val) { bindings.TxCreationKeys_set_broadcaster_delayed_payment_key(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -113,6 +129,11 @@ public class TxCreationKeys extends CommonBase { */ public static TxCreationKeys of(byte[] per_commitment_point_arg, byte[] revocation_key_arg, byte[] broadcaster_htlc_key_arg, byte[] countersignatory_htlc_key_arg, byte[] broadcaster_delayed_payment_key_arg) { long ret = bindings.TxCreationKeys_new(InternalUtils.check_arr_len(per_commitment_point_arg, 33), InternalUtils.check_arr_len(revocation_key_arg, 33), InternalUtils.check_arr_len(broadcaster_htlc_key_arg, 33), InternalUtils.check_arr_len(countersignatory_htlc_key_arg, 33), InternalUtils.check_arr_len(broadcaster_delayed_payment_key_arg, 33)); + Reference.reachabilityFence(per_commitment_point_arg); + Reference.reachabilityFence(revocation_key_arg); + Reference.reachabilityFence(broadcaster_htlc_key_arg); + Reference.reachabilityFence(countersignatory_htlc_key_arg); + Reference.reachabilityFence(broadcaster_delayed_payment_key_arg); if (ret >= 0 && ret <= 4096) { return null; } TxCreationKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TxCreationKeys(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -121,6 +142,7 @@ public class TxCreationKeys extends CommonBase { long clone_ptr() { long ret = bindings.TxCreationKeys_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -129,6 +151,7 @@ public class TxCreationKeys extends CommonBase { */ public TxCreationKeys clone() { long ret = bindings.TxCreationKeys_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } TxCreationKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new TxCreationKeys(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -140,6 +163,7 @@ public class TxCreationKeys extends CommonBase { */ public byte[] write() { byte[] ret = bindings.TxCreationKeys_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -148,6 +172,7 @@ public class TxCreationKeys extends CommonBase { */ public static Result_TxCreationKeysDecodeErrorZ read(byte[] ser) { long ret = bindings.TxCreationKeys_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysDecodeErrorZ ret_hu_conv = Result_TxCreationKeysDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -159,6 +184,11 @@ public class TxCreationKeys extends CommonBase { */ public static Result_TxCreationKeysErrorZ derive_new(byte[] per_commitment_point, byte[] broadcaster_delayed_payment_base, byte[] broadcaster_htlc_base, byte[] countersignatory_revocation_base, byte[] countersignatory_htlc_base) { long ret = bindings.TxCreationKeys_derive_new(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(broadcaster_delayed_payment_base, 33), InternalUtils.check_arr_len(broadcaster_htlc_base, 33), InternalUtils.check_arr_len(countersignatory_revocation_base, 33), InternalUtils.check_arr_len(countersignatory_htlc_base, 33)); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(broadcaster_delayed_payment_base); + Reference.reachabilityFence(broadcaster_htlc_base); + Reference.reachabilityFence(countersignatory_revocation_base); + Reference.reachabilityFence(countersignatory_htlc_base); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -170,6 +200,9 @@ public class TxCreationKeys extends CommonBase { */ public static Result_TxCreationKeysErrorZ from_channel_static_keys(byte[] per_commitment_point, ChannelPublicKeys broadcaster_keys, ChannelPublicKeys countersignatory_keys) { long ret = bindings.TxCreationKeys_from_channel_static_keys(InternalUtils.check_arr_len(per_commitment_point, 33), broadcaster_keys == null ? 0 : broadcaster_keys.ptr & ~1, countersignatory_keys == null ? 0 : countersignatory_keys.ptr & ~1); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(broadcaster_keys); + Reference.reachabilityFence(countersignatory_keys); if (ret >= 0 && ret <= 4096) { return null; } Result_TxCreationKeysErrorZ ret_hu_conv = Result_TxCreationKeysErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(broadcaster_keys); diff --git a/src/main/java/org/ldk/structs/TxOut.java b/src/main/java/org/ldk/structs/TxOut.java index 80b67a24..a8f2f953 100644 --- a/src/main/java/org/ldk/structs/TxOut.java +++ b/src/main/java/org/ldk/structs/TxOut.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class TxOut extends CommonBase{ diff --git a/src/main/java/org/ldk/structs/Type.java b/src/main/java/org/ldk/structs/Type.java index f466a1c1..5d8c2d57 100644 --- a/src/main/java/org/ldk/structs/Type.java +++ b/src/main/java/org/ldk/structs/Type.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -63,6 +64,7 @@ public class Type extends CommonBase { */ public short type_id() { short ret = bindings.Type_type_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -71,6 +73,7 @@ public class Type extends CommonBase { */ public String debug_str() { String ret = bindings.Type_debug_str(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -79,11 +82,13 @@ public class Type extends CommonBase { */ public byte[] write() { byte[] ret = bindings.Type_write(this.ptr); + Reference.reachabilityFence(this); return ret; } long clone_ptr() { long ret = bindings.Type_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,6 +97,7 @@ public class Type extends CommonBase { */ public Type clone() { long ret = bindings.Type_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } Type ret_hu_conv = new Type(null, ret); ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java index 0eab38d2..58b5d170 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelAnnouncement.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public ChannelFeatures get_features() { long ret = bindings.UnsignedChannelAnnouncement_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,8 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_features(ChannelFeatures val) { bindings.UnsignedChannelAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.UnsignedChannelAnnouncement_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.UnsignedChannelAnnouncement_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -57,6 +64,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public long get_short_channel_id() { long ret = bindings.UnsignedChannelAnnouncement_get_short_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -65,6 +73,8 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_short_channel_id(long val) { bindings.UnsignedChannelAnnouncement_set_short_channel_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +82,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public byte[] get_node_id_1() { byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_1(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +91,8 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_node_id_1(byte[] val) { bindings.UnsignedChannelAnnouncement_set_node_id_1(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -87,6 +100,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public byte[] get_node_id_2() { byte[] ret = bindings.UnsignedChannelAnnouncement_get_node_id_2(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -95,6 +109,8 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_node_id_2(byte[] val) { bindings.UnsignedChannelAnnouncement_set_node_id_2(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -102,6 +118,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public byte[] get_bitcoin_key_1() { byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_1(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -110,6 +127,8 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_bitcoin_key_1(byte[] val) { bindings.UnsignedChannelAnnouncement_set_bitcoin_key_1(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -117,6 +136,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public byte[] get_bitcoin_key_2() { byte[] ret = bindings.UnsignedChannelAnnouncement_get_bitcoin_key_2(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -125,10 +145,13 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public void set_bitcoin_key_2(byte[] val) { bindings.UnsignedChannelAnnouncement_set_bitcoin_key_2(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.UnsignedChannelAnnouncement_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -137,6 +160,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public UnsignedChannelAnnouncement clone() { long ret = bindings.UnsignedChannelAnnouncement_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UnsignedChannelAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -148,6 +172,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UnsignedChannelAnnouncement_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -156,6 +181,7 @@ public class UnsignedChannelAnnouncement extends CommonBase { */ public static Result_UnsignedChannelAnnouncementDecodeErrorZ read(byte[] ser) { long ret = bindings.UnsignedChannelAnnouncement_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java index 57791437..8ef49b9e 100644 --- a/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java +++ b/src/main/java/org/ldk/structs/UnsignedChannelUpdate.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public byte[] get_chain_hash() { byte[] ret = bindings.UnsignedChannelUpdate_get_chain_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_chain_hash(byte[] val) { bindings.UnsignedChannelUpdate_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public long get_short_channel_id() { long ret = bindings.UnsignedChannelUpdate_get_short_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_short_channel_id(long val) { bindings.UnsignedChannelUpdate_set_short_channel_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public int get_timestamp() { int ret = bindings.UnsignedChannelUpdate_get_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_timestamp(int val) { bindings.UnsignedChannelUpdate_set_timestamp(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public byte get_flags() { byte ret = bindings.UnsignedChannelUpdate_get_flags(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_flags(byte val) { bindings.UnsignedChannelUpdate_set_flags(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -91,6 +104,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public short get_cltv_expiry_delta() { short ret = bindings.UnsignedChannelUpdate_get_cltv_expiry_delta(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -106,6 +120,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_cltv_expiry_delta(short val) { bindings.UnsignedChannelUpdate_set_cltv_expiry_delta(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -113,6 +129,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public long get_htlc_minimum_msat() { long ret = bindings.UnsignedChannelUpdate_get_htlc_minimum_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -121,6 +138,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_htlc_minimum_msat(long val) { bindings.UnsignedChannelUpdate_set_htlc_minimum_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -128,6 +147,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public int get_fee_base_msat() { int ret = bindings.UnsignedChannelUpdate_get_fee_base_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -136,6 +156,8 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_fee_base_msat(int val) { bindings.UnsignedChannelUpdate_set_fee_base_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -143,6 +165,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public int get_fee_proportional_millionths() { int ret = bindings.UnsignedChannelUpdate_get_fee_proportional_millionths(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -151,10 +174,13 @@ public class UnsignedChannelUpdate extends CommonBase { */ public void set_fee_proportional_millionths(int val) { bindings.UnsignedChannelUpdate_set_fee_proportional_millionths(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.UnsignedChannelUpdate_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -163,6 +189,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public UnsignedChannelUpdate clone() { long ret = bindings.UnsignedChannelUpdate_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UnsignedChannelUpdate ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedChannelUpdate(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -174,6 +201,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UnsignedChannelUpdate_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -182,6 +210,7 @@ public class UnsignedChannelUpdate extends CommonBase { */ public static Result_UnsignedChannelUpdateDecodeErrorZ read(byte[] ser) { long ret = bindings.UnsignedChannelUpdate_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedChannelUpdateDecodeErrorZ ret_hu_conv = Result_UnsignedChannelUpdateDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java index f558312e..7c6c614e 100644 --- a/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java +++ b/src/main/java/org/ldk/structs/UnsignedNodeAnnouncement.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public NodeFeatures get_features() { long ret = bindings.UnsignedNodeAnnouncement_get_features(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } NodeFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new NodeFeatures(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -35,6 +37,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_features(NodeFeatures val) { bindings.UnsignedNodeAnnouncement_set_features(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -42,6 +46,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public int get_timestamp() { int ret = bindings.UnsignedNodeAnnouncement_get_timestamp(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -50,6 +55,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_timestamp(int val) { bindings.UnsignedNodeAnnouncement_set_timestamp(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -58,6 +65,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] get_node_id() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_node_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -67,6 +75,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_node_id(byte[] val) { bindings.UnsignedNodeAnnouncement_set_node_id(this.ptr, InternalUtils.check_arr_len(val, 33)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -74,6 +84,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] get_rgb() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_rgb(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -82,6 +93,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_rgb(byte[] val) { bindings.UnsignedNodeAnnouncement_set_rgb(this.ptr, InternalUtils.check_arr_len(val, 3)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -90,6 +103,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] get_alias() { byte[] ret = bindings.UnsignedNodeAnnouncement_get_alias(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -99,6 +113,8 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_alias(byte[] val) { bindings.UnsignedNodeAnnouncement_set_alias(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -106,10 +122,13 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public void set_addresses(NetAddress[] val) { bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.UnsignedNodeAnnouncement_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -118,6 +137,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public UnsignedNodeAnnouncement clone() { long ret = bindings.UnsignedNodeAnnouncement_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UnsignedNodeAnnouncement ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UnsignedNodeAnnouncement(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -129,6 +149,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UnsignedNodeAnnouncement_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -137,6 +158,7 @@ public class UnsignedNodeAnnouncement extends CommonBase { */ public static Result_UnsignedNodeAnnouncementDecodeErrorZ read(byte[] ser) { long ret = bindings.UnsignedNodeAnnouncement_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UnsignedNodeAnnouncementDecodeErrorZ ret_hu_conv = Result_UnsignedNodeAnnouncementDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UpdateAddHTLC.java b/src/main/java/org/ldk/structs/UpdateAddHTLC.java index 5e9e25a2..d8944493 100644 --- a/src/main/java/org/ldk/structs/UpdateAddHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateAddHTLC.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UpdateAddHTLC extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class UpdateAddHTLC extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class UpdateAddHTLC extends CommonBase { */ public long get_htlc_id() { long ret = bindings.UpdateAddHTLC_get_htlc_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class UpdateAddHTLC extends CommonBase { */ public void set_htlc_id(long val) { bindings.UpdateAddHTLC_set_htlc_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class UpdateAddHTLC extends CommonBase { */ public long get_amount_msat() { long ret = bindings.UpdateAddHTLC_get_amount_msat(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class UpdateAddHTLC extends CommonBase { */ public void set_amount_msat(long val) { bindings.UpdateAddHTLC_set_amount_msat(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,7 @@ public class UpdateAddHTLC extends CommonBase { */ public byte[] get_payment_hash() { byte[] ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -77,6 +88,8 @@ public class UpdateAddHTLC extends CommonBase { */ public void set_payment_hash(byte[] val) { bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -84,6 +97,7 @@ public class UpdateAddHTLC extends CommonBase { */ public int get_cltv_expiry() { int ret = bindings.UpdateAddHTLC_get_cltv_expiry(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -92,10 +106,13 @@ public class UpdateAddHTLC extends CommonBase { */ public void set_cltv_expiry(int val) { bindings.UpdateAddHTLC_set_cltv_expiry(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.UpdateAddHTLC_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -104,6 +121,7 @@ public class UpdateAddHTLC extends CommonBase { */ public UpdateAddHTLC clone() { long ret = bindings.UpdateAddHTLC_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UpdateAddHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateAddHTLC(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -115,6 +133,7 @@ public class UpdateAddHTLC extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UpdateAddHTLC_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -123,6 +142,7 @@ public class UpdateAddHTLC extends CommonBase { */ public static Result_UpdateAddHTLCDecodeErrorZ read(byte[] ser) { long ret = bindings.UpdateAddHTLC_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UpdateFailHTLC.java b/src/main/java/org/ldk/structs/UpdateFailHTLC.java index 4878f340..62b6cdeb 100644 --- a/src/main/java/org/ldk/structs/UpdateFailHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFailHTLC.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UpdateFailHTLC extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.UpdateFailHTLC_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class UpdateFailHTLC extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.UpdateFailHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class UpdateFailHTLC extends CommonBase { */ public long get_htlc_id() { long ret = bindings.UpdateFailHTLC_get_htlc_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,10 +52,13 @@ public class UpdateFailHTLC extends CommonBase { */ public void set_htlc_id(long val) { bindings.UpdateFailHTLC_set_htlc_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.UpdateFailHTLC_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -59,6 +67,7 @@ public class UpdateFailHTLC extends CommonBase { */ public UpdateFailHTLC clone() { long ret = bindings.UpdateFailHTLC_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UpdateFailHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFailHTLC(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -70,6 +79,7 @@ public class UpdateFailHTLC extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UpdateFailHTLC_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -78,6 +88,7 @@ public class UpdateFailHTLC extends CommonBase { */ public static Result_UpdateFailHTLCDecodeErrorZ read(byte[] ser) { long ret = bindings.UpdateFailHTLC_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java index 29c7eb56..a1961cc7 100644 --- a/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFailMalformedHTLC.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.UpdateFailMalformedHTLC_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.UpdateFailMalformedHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public long get_htlc_id() { long ret = bindings.UpdateFailMalformedHTLC_get_htlc_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public void set_htlc_id(long val) { bindings.UpdateFailMalformedHTLC_set_htlc_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public short get_failure_code() { short ret = bindings.UpdateFailMalformedHTLC_get_failure_code(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,10 +70,13 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public void set_failure_code(short val) { bindings.UpdateFailMalformedHTLC_set_failure_code(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } long clone_ptr() { long ret = bindings.UpdateFailMalformedHTLC_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -74,6 +85,7 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public UpdateFailMalformedHTLC clone() { long ret = bindings.UpdateFailMalformedHTLC_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UpdateFailMalformedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFailMalformedHTLC(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -85,6 +97,7 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UpdateFailMalformedHTLC_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -93,6 +106,7 @@ public class UpdateFailMalformedHTLC extends CommonBase { */ public static Result_UpdateFailMalformedHTLCDecodeErrorZ read(byte[] ser) { long ret = bindings.UpdateFailMalformedHTLC_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFailMalformedHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFailMalformedHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UpdateFee.java b/src/main/java/org/ldk/structs/UpdateFee.java index 2df919fe..07911b5e 100644 --- a/src/main/java/org/ldk/structs/UpdateFee.java +++ b/src/main/java/org/ldk/structs/UpdateFee.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UpdateFee extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.UpdateFee_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class UpdateFee extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.UpdateFee_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class UpdateFee extends CommonBase { */ public int get_feerate_per_kw() { int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class UpdateFee extends CommonBase { */ public void set_feerate_per_kw(int val) { bindings.UpdateFee_set_feerate_per_kw(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,8 @@ public class UpdateFee extends CommonBase { */ public static UpdateFee of(byte[] channel_id_arg, int feerate_per_kw_arg) { long ret = bindings.UpdateFee_new(InternalUtils.check_arr_len(channel_id_arg, 32), feerate_per_kw_arg); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(feerate_per_kw_arg); if (ret >= 0 && ret <= 4096) { return null; } UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFee(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -62,6 +71,7 @@ public class UpdateFee extends CommonBase { long clone_ptr() { long ret = bindings.UpdateFee_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -70,6 +80,7 @@ public class UpdateFee extends CommonBase { */ public UpdateFee clone() { long ret = bindings.UpdateFee_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFee(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -81,6 +92,7 @@ public class UpdateFee extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UpdateFee_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -89,6 +101,7 @@ public class UpdateFee extends CommonBase { */ public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) { long ret = bindings.UpdateFee_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java index 16fd61a6..7236463b 100644 --- a/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java +++ b/src/main/java/org/ldk/structs/UpdateFulfillHTLC.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -24,6 +25,7 @@ public class UpdateFulfillHTLC extends CommonBase { */ public byte[] get_channel_id() { byte[] ret = bindings.UpdateFulfillHTLC_get_channel_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -32,6 +34,8 @@ public class UpdateFulfillHTLC extends CommonBase { */ public void set_channel_id(byte[] val) { bindings.UpdateFulfillHTLC_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -39,6 +43,7 @@ public class UpdateFulfillHTLC extends CommonBase { */ public long get_htlc_id() { long ret = bindings.UpdateFulfillHTLC_get_htlc_id(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +52,8 @@ public class UpdateFulfillHTLC extends CommonBase { */ public void set_htlc_id(long val) { bindings.UpdateFulfillHTLC_set_htlc_id(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +61,7 @@ public class UpdateFulfillHTLC extends CommonBase { */ public byte[] get_payment_preimage() { byte[] ret = bindings.UpdateFulfillHTLC_get_payment_preimage(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -62,6 +70,8 @@ public class UpdateFulfillHTLC extends CommonBase { */ public void set_payment_preimage(byte[] val) { bindings.UpdateFulfillHTLC_set_payment_preimage(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -69,6 +79,9 @@ public class UpdateFulfillHTLC extends CommonBase { */ public static UpdateFulfillHTLC of(byte[] channel_id_arg, long htlc_id_arg, byte[] payment_preimage_arg) { long ret = bindings.UpdateFulfillHTLC_new(InternalUtils.check_arr_len(channel_id_arg, 32), htlc_id_arg, InternalUtils.check_arr_len(payment_preimage_arg, 32)); + Reference.reachabilityFence(channel_id_arg); + Reference.reachabilityFence(htlc_id_arg); + Reference.reachabilityFence(payment_preimage_arg); if (ret >= 0 && ret <= 4096) { return null; } UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFulfillHTLC(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -77,6 +90,7 @@ public class UpdateFulfillHTLC extends CommonBase { long clone_ptr() { long ret = bindings.UpdateFulfillHTLC_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -85,6 +99,7 @@ public class UpdateFulfillHTLC extends CommonBase { */ public UpdateFulfillHTLC clone() { long ret = bindings.UpdateFulfillHTLC_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UpdateFulfillHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UpdateFulfillHTLC(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -96,6 +111,7 @@ public class UpdateFulfillHTLC extends CommonBase { */ public byte[] write() { byte[] ret = bindings.UpdateFulfillHTLC_write(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -104,6 +120,7 @@ public class UpdateFulfillHTLC extends CommonBase { */ public static Result_UpdateFulfillHTLCDecodeErrorZ read(byte[] ser) { long ret = bindings.UpdateFulfillHTLC_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_UpdateFulfillHTLCDecodeErrorZ ret_hu_conv = Result_UpdateFulfillHTLCDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; diff --git a/src/main/java/org/ldk/structs/UserConfig.java b/src/main/java/org/ldk/structs/UserConfig.java index 055f38fe..23078a60 100644 --- a/src/main/java/org/ldk/structs/UserConfig.java +++ b/src/main/java/org/ldk/structs/UserConfig.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -27,6 +28,7 @@ public class UserConfig extends CommonBase { */ public ChannelHandshakeConfig get_own_channel_config() { long ret = bindings.UserConfig_get_own_channel_config(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -38,6 +40,8 @@ public class UserConfig extends CommonBase { */ public void set_own_channel_config(ChannelHandshakeConfig val) { bindings.UserConfig_set_own_channel_config(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -45,6 +49,7 @@ public class UserConfig extends CommonBase { */ public ChannelHandshakeLimits get_peer_channel_config_limits() { long ret = bindings.UserConfig_get_peer_channel_config_limits(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelHandshakeLimits ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelHandshakeLimits(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -56,6 +61,8 @@ public class UserConfig extends CommonBase { */ public void set_peer_channel_config_limits(ChannelHandshakeLimits val) { bindings.UserConfig_set_peer_channel_config_limits(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -63,6 +70,7 @@ public class UserConfig extends CommonBase { */ public ChannelConfig get_channel_options() { long ret = bindings.UserConfig_get_channel_options(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } ChannelConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -74,6 +82,8 @@ public class UserConfig extends CommonBase { */ public void set_channel_options(ChannelConfig val) { bindings.UserConfig_set_channel_options(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -96,6 +106,7 @@ public class UserConfig extends CommonBase { */ public boolean get_accept_forwards_to_priv_channels() { boolean ret = bindings.UserConfig_get_accept_forwards_to_priv_channels(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -119,13 +130,40 @@ public class UserConfig extends CommonBase { */ public void set_accept_forwards_to_priv_channels(boolean val) { bindings.UserConfig_set_accept_forwards_to_priv_channels(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); + } + + /** + * If this is set to false, we do not accept inbound requests to open a new channel. + * Default value: true. + */ + public boolean get_accept_inbound_channels() { + boolean ret = bindings.UserConfig_get_accept_inbound_channels(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + + /** + * If this is set to false, we do not accept inbound requests to open a new channel. + * Default value: true. + */ + public void set_accept_inbound_channels(boolean val) { + bindings.UserConfig_set_accept_inbound_channels(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** * Constructs a new UserConfig given each field */ - public static UserConfig of(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg, boolean accept_forwards_to_priv_channels_arg) { - long ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1, accept_forwards_to_priv_channels_arg); + public static UserConfig of(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg) { + long ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); + Reference.reachabilityFence(own_channel_config_arg); + Reference.reachabilityFence(peer_channel_config_limits_arg); + Reference.reachabilityFence(channel_options_arg); + Reference.reachabilityFence(accept_forwards_to_priv_channels_arg); + Reference.reachabilityFence(accept_inbound_channels_arg); if (ret >= 0 && ret <= 4096) { return null; } UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UserConfig(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -134,6 +172,7 @@ public class UserConfig extends CommonBase { long clone_ptr() { long ret = bindings.UserConfig_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -142,6 +181,7 @@ public class UserConfig extends CommonBase { */ public UserConfig clone() { long ret = bindings.UserConfig_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } UserConfig ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new UserConfig(null, ret); } ret_hu_conv.ptrs_to.add(this); diff --git a/src/main/java/org/ldk/structs/UtilMethods.java b/src/main/java/org/ldk/structs/UtilMethods.java index f3bc9b17..653c519d 100644 --- a/src/main/java/org/ldk/structs/UtilMethods.java +++ b/src/main/java/org/ldk/structs/UtilMethods.java @@ -3,14 +3,32 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; public class UtilMethods { + /** + * Constructs a new COption_NoneZ containing a + */ + public static COption_NoneZ COption_NoneZ_some() { + COption_NoneZ ret = bindings.COption_NoneZ_some(); + return ret; + } + + /** + * Constructs a new COption_NoneZ containing nothing + */ + public static COption_NoneZ COption_NoneZ_none() { + COption_NoneZ ret = bindings.COption_NoneZ_none(); + return ret; + } + /** * Read a ClosureReason from a byte array, created by ClosureReason_write */ public static Result_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(byte[] ser) { long ret = bindings.ClosureReason_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -21,6 +39,7 @@ public class UtilMethods { */ public static Result_COption_EventZDecodeErrorZ Event_read(byte[] ser) { long ret = bindings.Event_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -33,6 +52,8 @@ public class UtilMethods { */ public static Result_StringErrorZ sign(byte[] msg, byte[] sk) { long ret = bindings.sign(msg, InternalUtils.check_arr_len(sk, 32)); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(sk); if (ret >= 0 && ret <= 4096) { return null; } Result_StringErrorZ ret_hu_conv = Result_StringErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -43,6 +64,8 @@ public class UtilMethods { */ public static Result_PublicKeyErrorZ recover_pk(byte[] msg, java.lang.String sig) { long ret = bindings.recover_pk(msg, sig); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(sig); if (ret >= 0 && ret <= 4096) { return null; } Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -54,6 +77,9 @@ public class UtilMethods { */ public static boolean verify(byte[] msg, java.lang.String sig, byte[] pk) { boolean ret = bindings.verify(msg, sig, InternalUtils.check_arr_len(pk, 33)); + Reference.reachabilityFence(msg); + Reference.reachabilityFence(sig); + Reference.reachabilityFence(pk); return ret; } @@ -62,6 +88,7 @@ public class UtilMethods { */ public static Result_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(byte[] ser) { long ret = bindings.MonitorEvent_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -72,6 +99,8 @@ public class UtilMethods { */ public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, KeysInterface arg) { long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg == null ? 0 : arg.ptr); + Reference.reachabilityFence(ser); + Reference.reachabilityFence(arg); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(arg); @@ -83,6 +112,14 @@ public class UtilMethods { */ public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) { long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr & ~1, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr & ~1).toArray() : null)); + Reference.reachabilityFence(ser); + Reference.reachabilityFence(arg_keys_manager); + Reference.reachabilityFence(arg_fee_estimator); + Reference.reachabilityFence(arg_chain_monitor); + Reference.reachabilityFence(arg_tx_broadcaster); + Reference.reachabilityFence(arg_logger); + Reference.reachabilityFence(arg_default_config); + Reference.reachabilityFence(arg_channel_monitors); if (ret >= 0 && ret <= 4096) { return null; } Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(arg_keys_manager); @@ -95,11 +132,31 @@ public class UtilMethods { return ret_hu_conv; } + /** + * Gets the weight for an HTLC-Success transaction. + */ + public static long htlc_success_tx_weight(boolean opt_anchors) { + long ret = bindings.htlc_success_tx_weight(opt_anchors); + Reference.reachabilityFence(opt_anchors); + return ret; + } + + /** + * Gets the weight for an HTLC-Timeout transaction. + */ + public static long htlc_timeout_tx_weight(boolean opt_anchors) { + long ret = bindings.htlc_timeout_tx_weight(opt_anchors); + Reference.reachabilityFence(opt_anchors); + return ret; + } + /** * Build the commitment secret from the seed and the commitment number */ public static byte[] build_commitment_secret(byte[] commitment_seed, long idx) { byte[] ret = bindings.build_commitment_secret(InternalUtils.check_arr_len(commitment_seed, 32), idx); + Reference.reachabilityFence(commitment_seed); + Reference.reachabilityFence(idx); return ret; } @@ -108,6 +165,11 @@ public class UtilMethods { */ public static byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, OutPoint funding_outpoint) { byte[] ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1); + Reference.reachabilityFence(to_holder_value_sat); + Reference.reachabilityFence(to_counterparty_value_sat); + Reference.reachabilityFence(to_holder_script); + Reference.reachabilityFence(to_counterparty_script); + Reference.reachabilityFence(funding_outpoint); return ret; } @@ -120,6 +182,8 @@ public class UtilMethods { */ public static Result_SecretKeyErrorZ derive_private_key(byte[] per_commitment_point, byte[] base_secret) { long ret = bindings.derive_private_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_secret, 32)); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(base_secret); if (ret >= 0 && ret <= 4096) { return null; } Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -135,6 +199,8 @@ public class UtilMethods { */ public static Result_PublicKeyErrorZ derive_public_key(byte[] per_commitment_point, byte[] base_point) { long ret = bindings.derive_public_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_point, 33)); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(base_point); if (ret >= 0 && ret <= 4096) { return null; } Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -153,6 +219,8 @@ public class UtilMethods { */ public static Result_SecretKeyErrorZ derive_private_revocation_key(byte[] per_commitment_secret, byte[] countersignatory_revocation_base_secret) { long ret = bindings.derive_private_revocation_key(InternalUtils.check_arr_len(per_commitment_secret, 32), InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32)); + Reference.reachabilityFence(per_commitment_secret); + Reference.reachabilityFence(countersignatory_revocation_base_secret); if (ret >= 0 && ret <= 4096) { return null; } Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -173,6 +241,8 @@ public class UtilMethods { */ public static Result_PublicKeyErrorZ derive_public_revocation_key(byte[] per_commitment_point, byte[] countersignatory_revocation_base_point) { long ret = bindings.derive_public_revocation_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33)); + Reference.reachabilityFence(per_commitment_point); + Reference.reachabilityFence(countersignatory_revocation_base_point); if (ret >= 0 && ret <= 4096) { return null; } Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -185,6 +255,9 @@ public class UtilMethods { */ public static byte[] get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key) { byte[] ret = bindings.get_revokeable_redeemscript(InternalUtils.check_arr_len(revocation_key, 33), contest_delay, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33)); + Reference.reachabilityFence(revocation_key); + Reference.reachabilityFence(contest_delay); + Reference.reachabilityFence(broadcaster_delayed_payment_key); return ret; } @@ -192,8 +265,11 @@ public class UtilMethods { * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc * does not need to have its previous_output_index filled. */ - public static byte[] get_htlc_redeemscript(HTLCOutputInCommitment htlc, TxCreationKeys keys) { - byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr & ~1, keys == null ? 0 : keys.ptr & ~1); + public static byte[] get_htlc_redeemscript(HTLCOutputInCommitment htlc, boolean opt_anchors, TxCreationKeys keys) { + byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr & ~1, opt_anchors, keys == null ? 0 : keys.ptr & ~1); + Reference.reachabilityFence(htlc); + Reference.reachabilityFence(opt_anchors); + Reference.reachabilityFence(keys); // this.ptrs_to.add(htlc); // this.ptrs_to.add(keys); return ret; @@ -205,6 +281,8 @@ public class UtilMethods { */ public static byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory) { byte[] ret = bindings.make_funding_redeemscript(InternalUtils.check_arr_len(broadcaster, 33), InternalUtils.check_arr_len(countersignatory, 33)); + Reference.reachabilityFence(broadcaster); + Reference.reachabilityFence(countersignatory); return ret; } @@ -217,12 +295,33 @@ public class UtilMethods { * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the * commitment transaction). */ - public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, HTLCOutputInCommitment htlc, byte[] broadcaster_delayed_payment_key, byte[] revocation_key) { - byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr & ~1, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33)); + public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, HTLCOutputInCommitment htlc, boolean opt_anchors, byte[] broadcaster_delayed_payment_key, byte[] revocation_key) { + byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr & ~1, opt_anchors, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33)); + Reference.reachabilityFence(commitment_txid); + Reference.reachabilityFence(feerate_per_kw); + Reference.reachabilityFence(contest_delay); + Reference.reachabilityFence(htlc); + Reference.reachabilityFence(opt_anchors); + Reference.reachabilityFence(broadcaster_delayed_payment_key); + Reference.reachabilityFence(revocation_key); // this.ptrs_to.add(htlc); return ret; } + /** + * Gets the witnessScript for an anchor output from the funding public key. + * The witness in the spending input must be: + * + * After 16 blocks of confirmation, an alternative satisfying witness could be: + * <> + * (empty vector required to satisfy compliance with MINIMALIF-standard rule) + */ + public static byte[] get_anchor_redeemscript(byte[] funding_pubkey) { + byte[] ret = bindings.get_anchor_redeemscript(InternalUtils.check_arr_len(funding_pubkey, 33)); + Reference.reachabilityFence(funding_pubkey); + return ret; + } + /** * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a * shared secret first. This prevents on-chain observers from discovering how many commitment @@ -233,6 +332,9 @@ public class UtilMethods { */ public static long get_commitment_transaction_number_obscure_factor(byte[] broadcaster_payment_basepoint, byte[] countersignatory_payment_basepoint, boolean outbound_from_broadcaster) { long ret = bindings.get_commitment_transaction_number_obscure_factor(InternalUtils.check_arr_len(broadcaster_payment_basepoint, 33), InternalUtils.check_arr_len(countersignatory_payment_basepoint, 33), outbound_from_broadcaster); + Reference.reachabilityFence(broadcaster_payment_basepoint); + Reference.reachabilityFence(countersignatory_payment_basepoint); + Reference.reachabilityFence(outbound_from_broadcaster); return ret; } @@ -241,6 +343,7 @@ public class UtilMethods { */ public static Result_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(byte[] ser) { long ret = bindings.NetworkUpdate_read(ser); + Reference.reachabilityFence(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; @@ -280,6 +383,12 @@ public class UtilMethods { */ public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, RouteParameters params, NetworkGraph network, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer) { long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), params == null ? 0 : params.ptr & ~1, network == null ? 0 : network.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr); + Reference.reachabilityFence(our_node_pubkey); + Reference.reachabilityFence(params); + Reference.reachabilityFence(network); + Reference.reachabilityFence(first_hops); + Reference.reachabilityFence(logger); + Reference.reachabilityFence(scorer); if (ret >= 0 && ret <= 4096) { return null; } Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(params); @@ -296,6 +405,8 @@ public class UtilMethods { */ public static Result_NoneErrorZ FilesystemPersister_persist_manager(java.lang.String data_dir, ChannelManager manager) { long ret = bindings.FilesystemPersister_persist_manager(data_dir, manager == null ? 0 : manager.ptr & ~1); + Reference.reachabilityFence(data_dir); + Reference.reachabilityFence(manager); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(manager); @@ -311,6 +422,11 @@ public class UtilMethods { */ public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, java.lang.String description) { long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description); + Reference.reachabilityFence(channelmanager); + Reference.reachabilityFence(keys_manager); + Reference.reachabilityFence(network); + Reference.reachabilityFence(amt_msat); + Reference.reachabilityFence(description); if (ret >= 0 && ret <= 4096) { return null; } Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(channelmanager); diff --git a/src/main/java/org/ldk/structs/Watch.java b/src/main/java/org/ldk/structs/Watch.java index a8bc48e8..62f13e5e 100644 --- a/src/main/java/org/ldk/structs/Watch.java +++ b/src/main/java/org/ldk/structs/Watch.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; /** @@ -125,6 +126,9 @@ public class Watch extends CommonBase { */ public Result_NoneChannelMonitorUpdateErrZ watch_channel(OutPoint funding_txo, ChannelMonitor monitor) { long ret = bindings.Watch_watch_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, monitor == null ? 0 : monitor.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_txo); + Reference.reachabilityFence(monitor); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); return ret_hu_conv; @@ -140,6 +144,9 @@ public class Watch extends CommonBase { */ public Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) { long ret = bindings.Watch_update_channel(this.ptr, funding_txo == null ? 0 : funding_txo.ptr & ~1, update == null ? 0 : update.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(funding_txo); + Reference.reachabilityFence(update); if (ret >= 0 && ret <= 4096) { return null; } Result_NoneChannelMonitorUpdateErrZ ret_hu_conv = Result_NoneChannelMonitorUpdateErrZ.constr_from_ptr(ret); return ret_hu_conv; @@ -158,6 +165,7 @@ public class Watch extends CommonBase { */ public MonitorEvent[] release_pending_monitor_events() { long[] ret = bindings.Watch_release_pending_monitor_events(this.ptr); + Reference.reachabilityFence(this); MonitorEvent[] ret_conv_14_arr = new MonitorEvent[ret.length]; for (int o = 0; o < ret.length; o++) { long ret_conv_14 = ret[o]; diff --git a/src/main/java/org/ldk/structs/WatchedOutput.java b/src/main/java/org/ldk/structs/WatchedOutput.java index c0e7403d..2f79d23a 100644 --- a/src/main/java/org/ldk/structs/WatchedOutput.java +++ b/src/main/java/org/ldk/structs/WatchedOutput.java @@ -4,6 +4,7 @@ import org.ldk.impl.bindings; import org.ldk.enums.*; import org.ldk.util.*; import java.util.Arrays; +import java.lang.ref.Reference; import javax.annotation.Nullable; @@ -37,6 +38,7 @@ public class WatchedOutput extends CommonBase { @Nullable public byte[] get_block_hash() { byte[] ret = bindings.WatchedOutput_get_block_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -47,6 +49,8 @@ public class WatchedOutput extends CommonBase { */ public void set_block_hash(@Nullable byte[] val) { bindings.WatchedOutput_set_block_hash(this.ptr, InternalUtils.check_arr_len(val, 32)); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -54,6 +58,7 @@ public class WatchedOutput extends CommonBase { */ public OutPoint get_outpoint() { long ret = bindings.WatchedOutput_get_outpoint(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -65,6 +70,8 @@ public class WatchedOutput extends CommonBase { */ public void set_outpoint(OutPoint val) { bindings.WatchedOutput_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -72,6 +79,7 @@ public class WatchedOutput extends CommonBase { */ public byte[] get_script_pubkey() { byte[] ret = bindings.WatchedOutput_get_script_pubkey(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -80,6 +88,8 @@ public class WatchedOutput extends CommonBase { */ public void set_script_pubkey(byte[] val) { bindings.WatchedOutput_set_script_pubkey(this.ptr, val); + Reference.reachabilityFence(this); + Reference.reachabilityFence(val); } /** @@ -87,6 +97,9 @@ public class WatchedOutput extends CommonBase { */ public static WatchedOutput of(byte[] block_hash_arg, OutPoint outpoint_arg, byte[] script_pubkey_arg) { long ret = bindings.WatchedOutput_new(InternalUtils.check_arr_len(block_hash_arg, 32), outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, script_pubkey_arg); + Reference.reachabilityFence(block_hash_arg); + Reference.reachabilityFence(outpoint_arg); + Reference.reachabilityFence(script_pubkey_arg); if (ret >= 0 && ret <= 4096) { return null; } WatchedOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new WatchedOutput(null, ret); } ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -95,6 +108,7 @@ public class WatchedOutput extends CommonBase { long clone_ptr() { long ret = bindings.WatchedOutput_clone_ptr(this.ptr); + Reference.reachabilityFence(this); return ret; } @@ -103,6 +117,7 @@ public class WatchedOutput extends CommonBase { */ public WatchedOutput clone() { long ret = bindings.WatchedOutput_clone(this.ptr); + Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } WatchedOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new WatchedOutput(null, ret); } ret_hu_conv.ptrs_to.add(this); @@ -114,7 +129,11 @@ public class WatchedOutput extends CommonBase { */ public long hash() { long ret = bindings.WatchedOutput_hash(this.ptr); + Reference.reachabilityFence(this); return ret; } + @Override public int hashCode() { + return (int)this.hash(); + } } diff --git a/src/main/jni/bindings.c b/src/main/jni/bindings.c index 704f9f31..bf828ae8 100644 --- a/src/main/jni/bindings.c +++ b/src/main/jni/bindings.c @@ -9,6 +9,9 @@ #include #include +#define LIKELY(v) __builtin_expect(!!(v), 1) +#define UNLIKELY(v) __builtin_expect(!!(v), 0) + #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__) #define MALLOC(a, _) malloc(a) #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); } @@ -153,11 +156,17 @@ JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclas } static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; } static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKAccessError_UnknownChain; case 1: return LDKAccessError_UnknownTx; } - abort(); + (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass AccessError_class = NULL; static jfieldID AccessError_LDKAccessError_UnknownChain = NULL; @@ -180,12 +189,52 @@ static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) { } } +static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKCOption_NoneZ_Some; + case 1: return LDKCOption_NoneZ_None; + } + (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass COption_NoneZ_class = NULL; +static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL; +static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) { + COption_NoneZ_class = (*env)->NewGlobalRef(env, clz); + CHECK(COption_NoneZ_class != NULL); + COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;"); + CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL); + COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;"); + CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL); +} +static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) { + switch (val) { + case LDKCOption_NoneZ_Some: + return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some); + case LDKCOption_NoneZ_None: + return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None); + default: abort(); + } +} + static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure; case 1: return LDKChannelMonitorUpdateErr_PermanentFailure; } - abort(); + (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass ChannelMonitorUpdateErr_class = NULL; static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL; @@ -209,12 +258,18 @@ static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelM } static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKConfirmationTarget_Background; case 1: return LDKConfirmationTarget_Normal; case 2: return LDKConfirmationTarget_HighPriority; } - abort(); + (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass ConfirmationTarget_class = NULL; static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL; @@ -243,19 +298,27 @@ static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationT } static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKCreationError_DescriptionTooLong; case 1: return LDKCreationError_RouteTooLong; case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_ExpiryTimeOutOfBounds; + case 4: return LDKCreationError_InvalidAmount; } - abort(); + (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass CreationError_class = NULL; static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL; static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL; static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL; static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL; +static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) { CreationError_class = (*env)->NewGlobalRef(env, clz); CHECK(CreationError_class != NULL); @@ -267,6 +330,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclas CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL); CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL); + CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;"); + CHECK(CreationError_LDKCreationError_InvalidAmount != NULL); } static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) { switch (val) { @@ -278,19 +343,27 @@ static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds); case LDKCreationError_ExpiryTimeOutOfBounds: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds); + case LDKCreationError_InvalidAmount: + return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount); default: abort(); } } static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKCurrency_Bitcoin; case 1: return LDKCurrency_BitcoinTestnet; case 2: return LDKCurrency_Regtest; case 3: return LDKCurrency_Simnet; case 4: return LDKCurrency_Signet; } - abort(); + (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Currency_class = NULL; static jfieldID Currency_LDKCurrency_Bitcoin = NULL; @@ -329,7 +402,12 @@ static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) { } static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKIOError_NotFound; case 1: return LDKIOError_PermissionDenied; case 2: return LDKIOError_ConnectionRefused; @@ -349,7 +427,8 @@ static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) { case 16: return LDKIOError_Other; case 17: return LDKIOError_UnexpectedEof; } - abort(); + (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass IOError_class = NULL; static jfieldID IOError_LDKIOError_NotFound = NULL; @@ -453,16 +532,24 @@ static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) { } static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { - case 0: return LDKLevel_Trace; - case 1: return LDKLevel_Debug; - case 2: return LDKLevel_Info; - case 3: return LDKLevel_Warn; - case 4: return LDKLevel_Error; + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKLevel_Gossip; + case 1: return LDKLevel_Trace; + case 2: return LDKLevel_Debug; + case 3: return LDKLevel_Info; + case 4: return LDKLevel_Warn; + case 5: return LDKLevel_Error; } - abort(); + (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Level_class = NULL; +static jfieldID Level_LDKLevel_Gossip = NULL; static jfieldID Level_LDKLevel_Trace = NULL; static jfieldID Level_LDKLevel_Debug = NULL; static jfieldID Level_LDKLevel_Info = NULL; @@ -471,6 +558,8 @@ static jfieldID Level_LDKLevel_Error = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) { Level_class = (*env)->NewGlobalRef(env, clz); CHECK(Level_class != NULL); + Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;"); + CHECK(Level_LDKLevel_Gossip != NULL); Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;"); CHECK(Level_LDKLevel_Trace != NULL); Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;"); @@ -484,6 +573,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) { } static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) { switch (val) { + case LDKLevel_Gossip: + return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip); case LDKLevel_Trace: return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace); case LDKLevel_Debug: @@ -499,13 +590,19 @@ static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) { } static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKNetwork_Bitcoin; case 1: return LDKNetwork_Testnet; case 2: return LDKNetwork_Regtest; case 3: return LDKNetwork_Signet; } - abort(); + (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Network_class = NULL; static jfieldID Network_LDKNetwork_Bitcoin = NULL; @@ -539,7 +636,12 @@ static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) { } static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKSecp256k1Error_IncorrectSignature; case 1: return LDKSecp256k1Error_InvalidMessage; case 2: return LDKSecp256k1Error_InvalidPublicKey; @@ -550,7 +652,8 @@ static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass case 7: return LDKSecp256k1Error_TweakCheckFailed; case 8: return LDKSecp256k1Error_NotEnoughMemory; } - abort(); + (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Secp256k1Error_class = NULL; static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL; @@ -609,7 +712,12 @@ static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error va } static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKSemanticError_NoPaymentHash; case 1: return LDKSemanticError_MultiplePaymentHashes; case 2: return LDKSemanticError_NoDescription; @@ -621,7 +729,8 @@ static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass cl case 8: return LDKSemanticError_InvalidSignature; case 9: return LDKSemanticError_ImpreciseAmount; } - abort(); + (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass SemanticError_class = NULL; static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL; @@ -685,13 +794,19 @@ static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) } static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKSiPrefix_Milli; case 1: return LDKSiPrefix_Micro; case 2: return LDKSiPrefix_Nano; case 3: return LDKSiPrefix_Pico; } - abort(); + (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass SiPrefix_class = NULL; static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL; @@ -837,12 +952,12 @@ static jclass LDKCOption_u32Z_None_class = NULL; static jmethodID LDKCOption_u32Z_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) { LDKCOption_u32Z_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some")); CHECK(LDKCOption_u32Z_Some_class != NULL); LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "", "(I)V"); CHECK(LDKCOption_u32Z_Some_meth != NULL); LDKCOption_u32Z_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None")); CHECK(LDKCOption_u32Z_None_class != NULL); LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "", "()V"); CHECK(LDKCOption_u32Z_None_meth != NULL); @@ -1191,12 +1306,12 @@ static jclass LDKCOption_u64Z_None_class = NULL; static jmethodID LDKCOption_u64Z_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) { LDKCOption_u64Z_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some")); CHECK(LDKCOption_u64Z_Some_class != NULL); LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "", "(J)V"); CHECK(LDKCOption_u64Z_Some_meth != NULL); LDKCOption_u64Z_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None")); CHECK(LDKCOption_u64Z_None_class != NULL); LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "", "()V"); CHECK(LDKCOption_u64Z_None_meth != NULL); @@ -1383,22 +1498,22 @@ static jclass LDKMonitorEvent_UpdateFailed_class = NULL; static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) { LDKMonitorEvent_HTLCEvent_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent")); CHECK(LDKMonitorEvent_HTLCEvent_class != NULL); LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "", "(J)V"); CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL); LDKMonitorEvent_CommitmentTxConfirmed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed")); CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL); LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "", "(J)V"); CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL); LDKMonitorEvent_UpdateCompleted_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted")); CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL); LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "", "(JJ)V"); CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL); LDKMonitorEvent_UpdateFailed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed")); CHECK(LDKMonitorEvent_UpdateFailed_class != NULL); LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "", "(J)V"); CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL); @@ -1458,12 +1573,12 @@ static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL; static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) { LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some")); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL); LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "", "(J)V"); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL); LDKCOption_C2Tuple_usizeTransactionZZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None")); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL); LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "", "()V"); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL); @@ -1491,6 +1606,8 @@ static jclass LDKClosureReason_CooperativeClosure_class = NULL; static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL; static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL; static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL; +static jclass LDKClosureReason_FundingTimedOut_class = NULL; +static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL; static jclass LDKClosureReason_ProcessingError_class = NULL; static jmethodID LDKClosureReason_ProcessingError_meth = NULL; static jclass LDKClosureReason_DisconnectedPeer_class = NULL; @@ -1499,37 +1616,42 @@ static jclass LDKClosureReason_OutdatedChannelManager_class = NULL; static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) { LDKClosureReason_CounterpartyForceClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed")); CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL); LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "", "(Ljava/lang/String;)V"); CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL); LDKClosureReason_HolderForceClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed")); CHECK(LDKClosureReason_HolderForceClosed_class != NULL); LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "", "()V"); CHECK(LDKClosureReason_HolderForceClosed_meth != NULL); LDKClosureReason_CooperativeClosure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure")); CHECK(LDKClosureReason_CooperativeClosure_class != NULL); LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "", "()V"); CHECK(LDKClosureReason_CooperativeClosure_meth != NULL); LDKClosureReason_CommitmentTxConfirmed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed")); CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL); LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "", "()V"); CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL); + LDKClosureReason_FundingTimedOut_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut")); + CHECK(LDKClosureReason_FundingTimedOut_class != NULL); + LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "", "()V"); + CHECK(LDKClosureReason_FundingTimedOut_meth != NULL); LDKClosureReason_ProcessingError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError")); CHECK(LDKClosureReason_ProcessingError_class != NULL); LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "", "(Ljava/lang/String;)V"); CHECK(LDKClosureReason_ProcessingError_meth != NULL); LDKClosureReason_DisconnectedPeer_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer")); CHECK(LDKClosureReason_DisconnectedPeer_class != NULL); LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "", "()V"); CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL); LDKClosureReason_OutdatedChannelManager_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager")); CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL); LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "", "()V"); CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL); @@ -1551,6 +1673,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from case LDKClosureReason_CommitmentTxConfirmed: { return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth); } + case LDKClosureReason_FundingTimedOut: { + return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth); + } case LDKClosureReason_ProcessingError: { LDKStr err_str = obj->processing_error.err; jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); @@ -1571,12 +1696,12 @@ static jclass LDKCOption_ClosureReasonZ_None_class = NULL; static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) { LDKCOption_ClosureReasonZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some")); CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL); LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "", "(J)V"); CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL); LDKCOption_ClosureReasonZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None")); CHECK(LDKCOption_ClosureReasonZ_None_class != NULL); LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "", "()V"); CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL); @@ -1619,17 +1744,17 @@ static jclass LDKNetworkUpdate_NodeFailure_class = NULL; static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) { LDKNetworkUpdate_ChannelUpdateMessage_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage")); CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL); LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "", "(J)V"); CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL); LDKNetworkUpdate_ChannelClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed")); CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL); LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "", "(JZ)V"); CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL); LDKNetworkUpdate_NodeFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure")); CHECK(LDKNetworkUpdate_NodeFailure_class != NULL); LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "", "([BZ)V"); CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL); @@ -1663,12 +1788,12 @@ static jclass LDKCOption_NetworkUpdateZ_None_class = NULL; static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) { LDKCOption_NetworkUpdateZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some")); CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL); LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "", "(J)V"); CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL); LDKCOption_NetworkUpdateZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None")); CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL); LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "", "()V"); CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL); @@ -1694,17 +1819,17 @@ static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL; static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) { LDKSpendableOutputDescriptor_StaticOutput_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput")); CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL); LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "", "(JJ)V"); CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL); LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput")); CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL); LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "", "(J)V"); CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL); LDKSpendableOutputDescriptor_StaticPaymentOutput_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput")); CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL); LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "", "(J)V"); CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL); @@ -1756,12 +1881,12 @@ static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL; static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) { LDKPaymentPurpose_InvoicePayment_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment")); CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL); - LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "", "([B[BJ)V"); + LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "", "([B[B)V"); CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL); LDKPaymentPurpose_SpontaneousPayment_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment")); CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL); LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "", "([B)V"); CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL); @@ -1774,7 +1899,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1fro (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data); int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data); - return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id); + return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr); } case LDKPaymentPurpose_SpontaneousPayment: { int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32); @@ -1792,6 +1917,8 @@ static jclass LDKEvent_PaymentSent_class = NULL; static jmethodID LDKEvent_PaymentSent_meth = NULL; static jclass LDKEvent_PaymentPathFailed_class = NULL; static jmethodID LDKEvent_PaymentPathFailed_meth = NULL; +static jclass LDKEvent_PaymentFailed_class = NULL; +static jmethodID LDKEvent_PaymentFailed_meth = NULL; static jclass LDKEvent_PendingHTLCsForwardable_class = NULL; static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL; static jclass LDKEvent_SpendableOutputs_class = NULL; @@ -1802,52 +1929,64 @@ static jclass LDKEvent_ChannelClosed_class = NULL; static jmethodID LDKEvent_ChannelClosed_meth = NULL; static jclass LDKEvent_DiscardFunding_class = NULL; static jmethodID LDKEvent_DiscardFunding_meth = NULL; +static jclass LDKEvent_PaymentPathSuccessful_class = NULL; +static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady")); CHECK(LDKEvent_FundingGenerationReady_class != NULL); LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "", "([BJ[BJ)V"); CHECK(LDKEvent_FundingGenerationReady_meth != NULL); LDKEvent_PaymentReceived_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived")); CHECK(LDKEvent_PaymentReceived_class != NULL); LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "", "([BJJ)V"); CHECK(LDKEvent_PaymentReceived_meth != NULL); LDKEvent_PaymentSent_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent")); CHECK(LDKEvent_PaymentSent_class != NULL); LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B[B[BJ)V"); CHECK(LDKEvent_PaymentSent_meth != NULL); LDKEvent_PaymentPathFailed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); + LDKEvent_PaymentFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed")); + CHECK(LDKEvent_PaymentFailed_class != NULL); + LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "", "([B[B)V"); + CHECK(LDKEvent_PaymentFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable")); CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL); LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "", "(J)V"); CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL); LDKEvent_SpendableOutputs_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs")); CHECK(LDKEvent_SpendableOutputs_class != NULL); LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "", "([J)V"); CHECK(LDKEvent_SpendableOutputs_meth != NULL); LDKEvent_PaymentForwarded_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded")); CHECK(LDKEvent_PaymentForwarded_class != NULL); LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "", "(JZ)V"); CHECK(LDKEvent_PaymentForwarded_meth != NULL); LDKEvent_ChannelClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed")); CHECK(LDKEvent_ChannelClosed_class != NULL); LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "", "([BJJ)V"); CHECK(LDKEvent_ChannelClosed_meth != NULL); LDKEvent_DiscardFunding_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding")); CHECK(LDKEvent_DiscardFunding_class != NULL); LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "", "([B[B)V"); CHECK(LDKEvent_DiscardFunding_meth != NULL); + LDKEvent_PaymentPathSuccessful_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful")); + CHECK(LDKEvent_PaymentPathSuccessful_class != NULL); + LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "", "([B[B[J)V"); + CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -1907,6 +2046,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN } return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref, retry_ref); } + case LDKEvent_PaymentFailed: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data); + return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr); + } case LDKEvent_PendingHTLCsForwardable: { return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); } @@ -1940,6 +2086,27 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data); return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr); } + case LDKEvent_PaymentPathSuccessful: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data); + LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr); + } default: abort(); } } @@ -1949,12 +2116,12 @@ static jclass LDKCOption_EventZ_None_class = NULL; static jmethodID LDKCOption_EventZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) { LDKCOption_EventZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_EventZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some")); CHECK(LDKCOption_EventZ_Some_class != NULL); LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "", "(J)V"); CHECK(LDKCOption_EventZ_Some_meth != NULL); LDKCOption_EventZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_EventZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None")); CHECK(LDKCOption_EventZ_None_class != NULL); LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "", "()V"); CHECK(LDKCOption_EventZ_None_meth != NULL); @@ -1995,26 +2162,33 @@ static jclass LDKErrorAction_IgnoreError_class = NULL; static jmethodID LDKErrorAction_IgnoreError_meth = NULL; static jclass LDKErrorAction_IgnoreAndLog_class = NULL; static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL; +static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL; +static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL; static jclass LDKErrorAction_SendErrorMessage_class = NULL; static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) { LDKErrorAction_DisconnectPeer_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer")); CHECK(LDKErrorAction_DisconnectPeer_class != NULL); LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "", "(J)V"); CHECK(LDKErrorAction_DisconnectPeer_meth != NULL); LDKErrorAction_IgnoreError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError")); CHECK(LDKErrorAction_IgnoreError_class != NULL); LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "", "()V"); CHECK(LDKErrorAction_IgnoreError_meth != NULL); LDKErrorAction_IgnoreAndLog_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog")); CHECK(LDKErrorAction_IgnoreAndLog_class != NULL); LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "", "(Lorg/ldk/enums/Level;)V"); CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL); + LDKErrorAction_IgnoreDuplicateGossip_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip")); + CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL); + LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "", "()V"); + CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL); LDKErrorAction_SendErrorMessage_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage")); CHECK(LDKErrorAction_SendErrorMessage_class != NULL); LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "", "(J)V"); CHECK(LDKErrorAction_SendErrorMessage_meth != NULL); @@ -2040,6 +2214,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log); return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv); } + case LDKErrorAction_IgnoreDuplicateGossip: { + return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth); + } case LDKErrorAction_SendErrorMessage: { LDKErrorMessage msg_var = obj->send_error_message.msg; uint64_t msg_ref = 0; @@ -2092,97 +2269,97 @@ static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL; static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) { LDKMessageSendEvent_SendAcceptChannel_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel")); CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL); LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL); LDKMessageSendEvent_SendOpenChannel_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel")); CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL); LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL); LDKMessageSendEvent_SendFundingCreated_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated")); CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL); LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL); LDKMessageSendEvent_SendFundingSigned_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned")); CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL); LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL); LDKMessageSendEvent_SendFundingLocked_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked")); CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL); LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL); LDKMessageSendEvent_SendAnnouncementSignatures_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures")); CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL); LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL); LDKMessageSendEvent_UpdateHTLCs_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs")); CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL); LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL); LDKMessageSendEvent_SendRevokeAndACK_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK")); CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL); LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL); LDKMessageSendEvent_SendClosingSigned_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned")); CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL); LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL); LDKMessageSendEvent_SendShutdown_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown")); CHECK(LDKMessageSendEvent_SendShutdown_class != NULL); LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL); LDKMessageSendEvent_SendChannelReestablish_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish")); CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL); LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL); LDKMessageSendEvent_BroadcastChannelAnnouncement_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement")); CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL); LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "", "(JJ)V"); CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL); LDKMessageSendEvent_BroadcastNodeAnnouncement_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement")); CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL); LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "", "(J)V"); CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL); LDKMessageSendEvent_BroadcastChannelUpdate_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate")); CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL); LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "", "(J)V"); CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL); LDKMessageSendEvent_SendChannelUpdate_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate")); CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL); LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL); LDKMessageSendEvent_HandleError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError")); CHECK(LDKMessageSendEvent_HandleError_class != NULL); LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_HandleError_meth != NULL); LDKMessageSendEvent_SendChannelRangeQuery_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery")); CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL); LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL); LDKMessageSendEvent_SendShortIdsQuery_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery")); CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL); LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL); LDKMessageSendEvent_SendReplyChannelRange_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange")); CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL); LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL); @@ -2404,10 +2581,10 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInitFeatures res_var = (*val->contents.result); + LDKScoringParameters res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2415,8 +2592,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDec res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2426,10 +2603,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDec err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKNodeFeatures res_var = (*val->contents.result); + LDKScorer res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2437,8 +2614,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDec res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKInitFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var); + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2470,10 +2669,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeatures err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInvoiceFeatures res_var = (*val->contents.result); + LDKNodeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2481,8 +2680,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeatures res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2492,10 +2691,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeatures err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScoringParameters res_var = (*val->contents.result); + LDKInvoiceFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2503,8 +2702,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParamete res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2514,10 +2713,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParamete err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScorer res_var = (*val->contents.result); + LDKChannelTypeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2525,8 +2724,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErr res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2708,7 +2907,7 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception."); } @@ -2732,7 +2931,7 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception."); } @@ -2766,7 +2965,7 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception."); } @@ -2791,7 +2990,7 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception."); } @@ -2825,7 +3024,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception."); } @@ -2852,7 +3051,7 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const vo jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception."); } @@ -2887,7 +3086,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception."); } @@ -2918,7 +3117,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception."); } @@ -2959,7 +3158,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception."); } @@ -3000,7 +3199,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception."); } @@ -3035,7 +3234,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception."); } @@ -3070,7 +3269,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception."); } @@ -3105,7 +3304,7 @@ void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransaction jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception."); } @@ -3412,7 +3611,7 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception."); } @@ -3639,12 +3838,12 @@ static jclass LDKCOption_u16Z_None_class = NULL; static jmethodID LDKCOption_u16Z_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) { LDKCOption_u16Z_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some")); CHECK(LDKCOption_u16Z_Some_class != NULL); LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "", "(S)V"); CHECK(LDKCOption_u16Z_Some_meth != NULL); LDKCOption_u16Z_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None")); CHECK(LDKCOption_u16Z_None_class != NULL); LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "", "()V"); CHECK(LDKCOption_u16Z_None_meth != NULL); @@ -3675,32 +3874,32 @@ static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL; static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) { LDKAPIError_APIMisuseError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError")); CHECK(LDKAPIError_APIMisuseError_class != NULL); LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(Ljava/lang/String;)V"); CHECK(LDKAPIError_APIMisuseError_meth != NULL); LDKAPIError_FeeRateTooHigh_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh")); CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(Ljava/lang/String;I)V"); CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); LDKAPIError_RouteError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError")); CHECK(LDKAPIError_RouteError_class != NULL); LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "", "(Ljava/lang/String;)V"); CHECK(LDKAPIError_RouteError_meth != NULL); LDKAPIError_ChannelUnavailable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable")); CHECK(LDKAPIError_ChannelUnavailable_class != NULL); LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(Ljava/lang/String;)V"); CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); LDKAPIError_MonitorUpdateFailed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed")); CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL); LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "", "()V"); CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL); LDKAPIError_IncompatibleShutdownScript_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript")); CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL); LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "", "(J)V"); CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL); @@ -3791,22 +3990,22 @@ static jclass LDKPaymentSendFailure_PartialFailure_class = NULL; static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) { LDKPaymentSendFailure_ParameterError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError")); CHECK(LDKPaymentSendFailure_ParameterError_class != NULL); LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "", "(J)V"); CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL); LDKPaymentSendFailure_PathParameterError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError")); CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL); LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "", "([J)V"); CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL); LDKPaymentSendFailure_AllFailedRetrySafe_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe")); CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL); LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "", "([J)V"); CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL); LDKPaymentSendFailure_PartialFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure")); CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL); LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "", "([JJ[B)V"); CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL); @@ -3939,22 +4138,22 @@ static jclass LDKNetAddress_OnionV3_class = NULL; static jmethodID LDKNetAddress_OnionV3_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) { LDKNetAddress_IPv4_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4")); CHECK(LDKNetAddress_IPv4_class != NULL); LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "", "([BS)V"); CHECK(LDKNetAddress_IPv4_meth != NULL); LDKNetAddress_IPv6_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6")); CHECK(LDKNetAddress_IPv6_class != NULL); LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "", "([BS)V"); CHECK(LDKNetAddress_IPv6_meth != NULL); LDKNetAddress_OnionV2_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2")); CHECK(LDKNetAddress_OnionV2_class != NULL); - LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "", "([BS)V"); + LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "", "([B)V"); CHECK(LDKNetAddress_OnionV2_meth != NULL); LDKNetAddress_OnionV3_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3")); CHECK(LDKNetAddress_OnionV3_class != NULL); LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "([BSBS)V"); CHECK(LDKNetAddress_OnionV3_meth != NULL); @@ -3973,9 +4172,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1p return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port); } case LDKNetAddress_OnionV2: { - int8_tArray addr_arr = (*env)->NewByteArray(env, 10); - (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data); - return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port); + int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12); + (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data); + return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr); } case LDKNetAddress_OnionV3: { int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32); @@ -4012,6 +4211,45 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPay return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1); CHECK(val->result_ok); @@ -4025,6 +4263,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAP uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) { LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -4087,7 +4338,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception."); } @@ -4130,7 +4381,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception."); } @@ -4155,7 +4406,7 @@ LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception."); } @@ -4308,7 +4559,7 @@ void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, L jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception."); } @@ -4365,6 +4616,7 @@ typedef struct LDKKeysInterface_JCalls { jmethodID get_secure_random_bytes_meth; jmethodID read_chan_signer_meth; jmethodID sign_invoice_meth; + jmethodID get_inbound_payment_key_material_meth; } LDKKeysInterface_JCalls; static void LDKKeysInterface_JCalls_free(void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -4395,7 +4647,7 @@ LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception."); } @@ -4419,7 +4671,7 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception."); } @@ -4444,7 +4696,7 @@ LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* t jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception."); } @@ -4469,7 +4721,7 @@ LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inb jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception."); } @@ -4494,7 +4746,7 @@ LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* thi jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception."); } @@ -4521,7 +4773,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception."); } @@ -4550,7 +4802,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception."); } @@ -4563,6 +4815,30 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } return ret_conv; } +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception."); + } + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_ref; +} static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -4588,6 +4864,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j CHECK(calls->read_chan_signer_meth != NULL); calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J"); CHECK(calls->sign_invoice_meth != NULL); + calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B"); + CHECK(calls->get_inbound_payment_key_material_meth != NULL); LDKKeysInterface ret = { .this_arg = (void*) calls, @@ -4598,6 +4876,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .sign_invoice = sign_invoice_LDKKeysInterface_jcall, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, .free = LDKKeysInterface_JCalls_free, }; return ret; @@ -4687,6 +4966,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoic return (uint64_t)ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data); + return ret_arr; +} + typedef struct LDKFeeEstimator_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -4723,7 +5011,7 @@ uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception."); } @@ -4812,7 +5100,7 @@ void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception."); } @@ -4969,7 +5257,7 @@ uint16_t type_id_LDKType_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception."); } @@ -4990,7 +5278,7 @@ LDKStr debug_str_LDKType_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception."); } @@ -5012,7 +5300,7 @@ LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception."); } @@ -5093,12 +5381,12 @@ static jclass LDKCOption_TypeZ_None_class = NULL; static jmethodID LDKCOption_TypeZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) { LDKCOption_TypeZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some")); CHECK(LDKCOption_TypeZ_Some_class != NULL); LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "", "(J)V"); CHECK(LDKCOption_TypeZ_Some_meth != NULL); LDKCOption_TypeZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None")); CHECK(LDKCOption_TypeZ_None_class != NULL); LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "", "()V"); CHECK(LDKCOption_TypeZ_None_meth != NULL); @@ -5142,17 +5430,17 @@ static jclass LDKPaymentError_Sending_class = NULL; static jmethodID LDKPaymentError_Sending_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) { LDKPaymentError_Invoice_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Invoice;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice")); CHECK(LDKPaymentError_Invoice_class != NULL); LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "", "(Ljava/lang/String;)V"); CHECK(LDKPaymentError_Invoice_meth != NULL); LDKPaymentError_Routing_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Routing;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing")); CHECK(LDKPaymentError_Routing_class != NULL); LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "", "(J)V"); CHECK(LDKPaymentError_Routing_meth != NULL); LDKPaymentError_Sending_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Sending;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending")); CHECK(LDKPaymentError_Sending_class != NULL); LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(J)V"); CHECK(LDKPaymentError_Sending_meth != NULL); @@ -5442,12 +5730,12 @@ static jclass LDKCOption_MonitorEventZ_None_class = NULL; static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) { LDKCOption_MonitorEventZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some")); CHECK(LDKCOption_MonitorEventZ_Some_class != NULL); LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "", "(J)V"); CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL); LDKCOption_MonitorEventZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_MonitorEventZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None")); CHECK(LDKCOption_MonitorEventZ_None_class != NULL); LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "", "()V"); CHECK(LDKCOption_MonitorEventZ_None_meth != NULL); @@ -5504,22 +5792,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecod err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(val->result_ok); - return *val->contents.result; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(!val->result_ok); - LDKMonitorUpdateError err_var = (*val->contents.err); - uint64_t err_ref = 0; - CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); - err_ref = (uint64_t)err_var.inner & ~1; - return err_ref; -} static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){ return OutPoint_clone(&tuple->a); } @@ -5692,22 +5964,22 @@ static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL; static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) { LDKBalance_ClaimableOnChannelClose_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose")); CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL); LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "", "(J)V"); CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL); LDKBalance_ClaimableAwaitingConfirmations_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations")); CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL); LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "", "(JI)V"); CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL); LDKBalance_ContentiousClaimable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable")); CHECK(LDKBalance_ContentiousClaimable_class != NULL); LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "", "(JI)V"); CHECK(LDKBalance_ContentiousClaimable_meth != NULL); LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout")); CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL); LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "", "(JI)V"); CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL); @@ -6007,7 +6279,7 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception."); } @@ -6065,12 +6337,12 @@ static jclass LDKCOption_AccessZ_None_class = NULL; static jmethodID LDKCOption_AccessZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) { LDKCOption_AccessZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some")); CHECK(LDKCOption_AccessZ_Some_class != NULL); LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "", "(J)V"); CHECK(LDKCOption_AccessZ_Some_meth != NULL); LDKCOption_AccessZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None")); CHECK(LDKCOption_AccessZ_None_class != NULL); LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "", "()V"); CHECK(LDKCOption_AccessZ_None_meth != NULL); @@ -6237,12 +6509,12 @@ static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL; static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) { LDKCOption_CVec_NetAddressZZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some")); CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL); LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "", "([J)V"); CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL); LDKCOption_CVec_NetAddressZZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None")); CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL); LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "", "()V"); CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL); @@ -7023,12 +7295,12 @@ static jclass LDKSignOrCreationError_CreationError_class = NULL; static jmethodID LDKSignOrCreationError_CreationError_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) { LDKSignOrCreationError_SignError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError")); CHECK(LDKSignOrCreationError_SignError_class != NULL); LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "", "()V"); CHECK(LDKSignOrCreationError_SignError_meth != NULL); LDKSignOrCreationError_CreationError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError")); CHECK(LDKSignOrCreationError_CreationError_class != NULL); LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "", "(Lorg/ldk/enums/CreationError;)V"); CHECK(LDKSignOrCreationError_CreationError_meth != NULL); @@ -7104,7 +7376,7 @@ void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32 jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception."); } @@ -7133,7 +7405,7 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception."); } @@ -7211,12 +7483,12 @@ static jclass LDKCOption_FilterZ_None_class = NULL; static jmethodID LDKCOption_FilterZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) { LDKCOption_FilterZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some")); CHECK(LDKCOption_FilterZ_Some_class != NULL); LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "", "(J)V"); CHECK(LDKCOption_FilterZ_Some_meth != NULL); LDKCOption_FilterZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None")); CHECK(LDKCOption_FilterZ_None_class != NULL); LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "", "()V"); CHECK(LDKCOption_FilterZ_None_meth != NULL); @@ -7298,7 +7570,7 @@ LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsP jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception."); } @@ -7405,7 +7677,7 @@ void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * e jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception."); } @@ -7484,7 +7756,7 @@ void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEve jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception."); } @@ -7571,7 +7843,7 @@ void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uin jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception."); } @@ -7593,7 +7865,7 @@ void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* h jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception."); } @@ -7703,7 +7975,7 @@ void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception."); } @@ -7725,7 +7997,7 @@ void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_ jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception."); } @@ -7747,7 +8019,7 @@ void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception."); } @@ -7767,7 +8039,7 @@ LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception."); } @@ -7955,7 +8227,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception."); } @@ -8020,7 +8292,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception."); } @@ -8188,7 +8460,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception."); } @@ -8229,7 +8501,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception."); } @@ -8261,7 +8533,7 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception."); } @@ -8293,7 +8565,7 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception."); } @@ -8325,7 +8597,7 @@ void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception."); } @@ -8367,7 +8639,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception."); } @@ -8399,7 +8671,7 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception."); } @@ -8431,7 +8703,7 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8463,7 +8735,7 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_ jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8495,7 +8767,7 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8527,7 +8799,7 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8559,7 +8831,7 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception."); } @@ -8591,7 +8863,7 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception."); } @@ -8623,7 +8895,7 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception."); } @@ -8655,7 +8927,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception."); } @@ -8677,7 +8949,7 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception."); } @@ -8709,7 +8981,7 @@ void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPubl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception."); } @@ -8741,7 +9013,7 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_ jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception."); } @@ -8773,7 +9045,7 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception."); } @@ -8805,7 +9077,7 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception."); } @@ -9250,7 +9522,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9285,7 +9557,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9320,7 +9592,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9345,7 +9617,7 @@ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9384,7 +9656,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_j jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9433,7 +9705,7 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9464,7 +9736,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9500,7 +9772,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9536,7 +9808,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9572,7 +9844,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9852,7 +10124,7 @@ LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const voi jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception."); } @@ -9945,7 +10217,7 @@ LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jca jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception."); } @@ -9970,7 +10242,7 @@ LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandle jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception."); } @@ -10111,7 +10383,7 @@ uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, b jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception."); } @@ -10132,7 +10404,7 @@ void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception."); } @@ -10154,7 +10426,7 @@ bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescripto jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception."); } @@ -10175,7 +10447,7 @@ uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception."); } @@ -10253,6 +10525,7 @@ typedef struct LDKScore_JCalls { jweak o; jmethodID channel_penalty_msat_meth; jmethodID payment_path_failed_meth; + jmethodID payment_path_successful_meth; jmethodID write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { @@ -10272,7 +10545,7 @@ static void LDKScore_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -10281,6 +10554,9 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *channel_capacity_msat_copy = channel_capacity_msat; + uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy; LDKNodeId source_var = *source; uint64_t source_ref = 0; source_var = NodeId_clone(source); @@ -10303,8 +10579,8 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref); - if ((*env)->ExceptionCheck(env)) { + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); } @@ -10343,7 +10619,7 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception."); } @@ -10351,6 +10627,44 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } +void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; @@ -10363,7 +10677,7 @@ LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception."); } @@ -10387,10 +10701,12 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J"); + calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J"); CHECK(calls->channel_penalty_msat_meth != NULL); calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V"); CHECK(calls->payment_path_failed_meth != NULL); + calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V"); + CHECK(calls->payment_path_successful_meth != NULL); calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B"); CHECK(calls->write_meth != NULL); @@ -10398,6 +10714,7 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { .this_arg = (void*) calls, .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, .payment_path_failed = payment_path_failed_LDKScore_jcall, + .payment_path_successful = payment_path_successful_LDKScore_jcall, .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; @@ -10408,10 +10725,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, *res_ptr = LDKScore_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t channel_capacity_msat, int64_t source, int64_t target) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1); + CHECK_ACCESS(channel_capacity_msat_ptr); + LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr); + channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1)); LDKNodeId source_conv; source_conv.inner = (void*)(source & (~1)); source_conv.is_owned = false; @@ -10420,7 +10741,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1ms target_conv.inner = (void*)(target & (~1)); target_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv); return ret_val; } @@ -10448,6 +10769,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(J (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr); +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -10459,6 +10804,93 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *en return ret_arr; } +typedef struct LDKLockableScore_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID lock_meth; +} LDKLockableScore_JCalls; +static void LDKLockableScore_JCalls_free(void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKScore ret_conv = *(LDKScore*)(ret_ptr); + if (ret_conv.free == LDKScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKScore_JCalls_cloned(&ret_conv); + }// Warning: we may need a move here but no clone is available for LDKScore + + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J"); + CHECK(calls->lock_meth != NULL); + + LDKLockableScore ret = { + .this_arg = (void*) calls, + .lock = lock_LDKLockableScore_jcall, + .free = LDKLockableScore_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) { + LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore"); + *res_ptr = LDKLockableScore_init(env, clz, o); + return (uint64_t)res_ptr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr; + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg); + return (uint64_t)ret_ret; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -10504,7 +10936,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception."); } @@ -10564,17 +10996,17 @@ static jclass LDKFallback_ScriptHash_class = NULL; static jmethodID LDKFallback_ScriptHash_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) { LDKFallback_SegWitProgram_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram")); CHECK(LDKFallback_SegWitProgram_class != NULL); LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "", "(B[B)V"); CHECK(LDKFallback_SegWitProgram_meth != NULL); LDKFallback_PubKeyHash_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash")); CHECK(LDKFallback_PubKeyHash_class != NULL); LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "", "([B)V"); CHECK(LDKFallback_PubKeyHash_meth != NULL); LDKFallback_ScriptHash_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash")); CHECK(LDKFallback_ScriptHash_class != NULL); LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "", "([B)V"); CHECK(LDKFallback_ScriptHash_meth != NULL); @@ -10609,7 +11041,9 @@ typedef struct LDKPayer_JCalls { jmethodID node_id_meth; jmethodID first_hops_meth; jmethodID send_payment_meth; + jmethodID send_spontaneous_payment_meth; jmethodID retry_payment_meth; + jmethodID abandon_payment_meth; } LDKPayer_JCalls; static void LDKPayer_JCalls_free(void* this_arg) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; @@ -10640,7 +11074,7 @@ LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception."); } @@ -10664,7 +11098,7 @@ LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception."); } @@ -10715,7 +11149,7 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception."); } @@ -10728,6 +11162,43 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* } return ret_conv; } +LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(route); + CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = (uint64_t)route_var.inner; + if (route_var.is_owned) { + route_ref |= 1; + } + int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); + FREE((void*)ret); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; JNIEnv *env; @@ -10752,7 +11223,7 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception."); } @@ -10765,6 +11236,28 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this } return ret_conv; } +void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -10782,15 +11275,21 @@ static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) { CHECK(calls->first_hops_meth != NULL); calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J"); CHECK(calls->send_payment_meth != NULL); + calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J"); + CHECK(calls->send_spontaneous_payment_meth != NULL); calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J"); CHECK(calls->retry_payment_meth != NULL); + calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V"); + CHECK(calls->abandon_payment_meth != NULL); LDKPayer ret = { .this_arg = (void*) calls, .node_id = node_id_LDKPayer_jcall, .first_hops = first_hops_LDKPayer_jcall, .send_payment = send_payment_LDKPayer_jcall, + .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, .retry_payment = retry_payment_LDKPayer_jcall, + .abandon_payment = abandon_payment_LDKPayer_jcall, .free = LDKPayer_JCalls_free, }; return ret; @@ -10853,6 +11352,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); + (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -10869,6 +11384,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEn return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); +} + typedef struct LDKRouter_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -10892,7 +11417,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -10913,6 +11438,8 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, if (params_var.is_owned) { params_ref |= 1; } + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash); LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; int64_tArray first_hops_arr = NULL; if (first_hops != NULL) { @@ -10937,8 +11464,8 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, uint64_t ret_scorer = ((uint64_t)scorer) | 1; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer); - if ((*env)->ExceptionCheck(env)) { + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer); + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); } @@ -10962,7 +11489,7 @@ static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); + calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J"); CHECK(calls->find_route_meth != NULL); LDKRouter ret = { @@ -10977,7 +11504,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, *res_ptr = LDKRouter_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int64_tArray first_hops, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; @@ -10988,6 +11515,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv params_conv.inner = (void*)(params & (~1)); params_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + unsigned char payment_hash_arr[32]; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); + unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; LDKCVec_ChannelDetailsZ first_hops_constr; LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; if (first_hops != NULL) { @@ -11012,7 +11543,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } @@ -11421,6 +11952,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommit return (uint64_t)ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none()); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) { + LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res); + COption_NoneZ_free(_res_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKCounterpartyChannelTransactionParameters o_conv; o_conv.inner = (void*)(o & (~1)); @@ -13056,78 +13602,115 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free( CVec_MessageSendEventZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInitFeatures o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKScoringParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InitFeatures_clone(&o_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScoringParameters + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InitFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScoringParametersDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKNodeFeatures o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKScorer o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = NodeFeatures_clone(&o_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScorer + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScorerDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKInitFeatures o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = InitFeatures_clone(&o_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_InitFeaturesDecodeErrorZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { @@ -13167,115 +13750,115 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecode CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInvoiceFeatures o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKNodeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InvoiceFeatures_clone(&o_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); + o_conv = NodeFeatures_clone(&o_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); + CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKScoringParameters o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKInvoiceFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); + o_conv = InvoiceFeatures_clone(&o_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); + LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScoringParametersDecodeErrorZ_free(_res_conv); + CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKScorer o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelTypeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScorer - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); + o_conv = ChannelTypeFeatures_clone(&o_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScorerDecodeErrorZ_free(_res_conv); + CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { @@ -14507,6 +15090,156 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSec C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_err(); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1); + jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentSecretNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -14559,6 +15292,58 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIEr return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentPreimageAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_ChannelMonitorZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -15708,56 +16493,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeEr return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok(); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - LDKMonitorUpdateError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = MonitorUpdateError_clone(&e_conv); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NoneMonitorUpdateErrorZ* o_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(o & ~1); - jboolean ret_val = CResult_NoneMonitorUpdateErrorZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_NoneMonitorUpdateErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(arg); - return (uint64_t)ret_conv; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ* arg_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - int64_t ret_val = CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv); - return (uint64_t)ret_conv; -} - static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) { LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ"); *ret_conv = C2Tuple_OutPointScriptZ_clone(arg); @@ -19196,7 +19931,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) { LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); @@ -19204,7 +19939,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1pa CHECK((*env)->GetArrayLength(env, payment_secret) == 32); (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose"); - *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id); + *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -19277,6 +20012,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1 return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) { + LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); + *ret_copy = ClosureReason_funding_timed_out(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) { LDKStr err_conv = java_to_owned_str(env, err); LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); @@ -19438,6 +20180,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) { LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); *ret_copy = Event_pending_htlcs_forwardable(time_forwardable); @@ -19508,6 +20263,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNI return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -19987,6 +20772,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jc return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKLevel_to_java(env, Level_gossip()); + return ret_conv; +} + JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) { jclass ret_conv = LDKLevel_to_java(env, Level_trace()); return ret_conv; @@ -20839,7 +21629,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwa UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) { +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UserConfig_set_accept_inbound_channels(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) { LDKChannelHandshakeConfig own_channel_config_arg_conv; own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1)); own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0); @@ -20855,7 +21662,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); - LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg); + LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -21658,86 +22465,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read( return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKMonitorUpdateError this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - MonitorUpdateError_free(this_obj_conv); -} - -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv); - jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); - Str_free(ret_str); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr val_conv = java_to_owned_str(env, val); - MonitorUpdateError_set_a(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1new(JNIEnv *env, jclass clz, jstring a_arg) { - LDKStr a_arg_conv = java_to_owned_str(env, a_arg); - LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg) { - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(arg); -uint64_t ret_ref = 0; -CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. -CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. -CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); -ret_ref = (uint64_t)ret_var.inner; -if (ret_var.is_owned) { - ret_ref |= 1; -} - return ret_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKMonitorUpdateError arg_conv; - arg_conv.inner = (void*)(arg & (~1)); - arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - int64_t ret_val = MonitorUpdateError_clone_ptr(&arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKMonitorUpdateError orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); @@ -22042,7 +22769,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1mon void* logger_ptr = (void*)(((uint64_t)logger) & ~1); if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv); return (uint64_t)ret_conv; } @@ -23445,6 +24172,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channe return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -24201,6 +24937,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1cha ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ChannelDetails_set_balance_msat(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -24349,7 +25102,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi ChannelDetails_set_is_public(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); @@ -24378,7 +25131,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1)); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -24776,6 +25529,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1paym return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -24892,7 +25656,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -24901,12 +25665,43 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); - LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); - return ((uint64_t)ret_conv); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -24919,7 +25714,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); + *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } @@ -26025,6 +26836,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1fla OpenChannel_set_channel_flags(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv); + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + OpenChannel_set_channel_type(&this_ptr_conv, val_conv); +} + static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) { LDKOpenChannel ret_var = OpenChannel_clone(arg); uint64_t ret_ref = 0; @@ -28326,12 +29169,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *en return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) { - LDKTenBytes addr_ref; - CHECK((*env)->GetArrayLength(env, addr) == 10); - (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) { + LDKTwelveBytes a_ref; + CHECK((*env)->GetArrayLength(env, a) == 12); + (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data); LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); - *ret_copy = NetAddress_onion_v2(addr_ref, port); + *ret_copy = NetAddress_onion_v2(a_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -30026,6 +30869,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1l return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) { + LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction"); + *ret_copy = ErrorAction_ignore_duplicate_gossip(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) { LDKErrorMessage msg_conv; msg_conv.inner = (void*)(msg & (~1)); @@ -31761,6 +32611,16 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occu PeerManager_timer_tick_occurred(&this_arg_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) { + int64_t ret_val = htlc_success_tx_weight(opt_anchors); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) { + int64_t ret_val = htlc_timeout_tx_weight(opt_anchors); + return ret_val; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) { unsigned char commitment_seed_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_seed) == 32); @@ -32480,7 +33340,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1rea return (uint64_t)ret_conv; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, jboolean opt_anchors, int64_t keys) { LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = false; @@ -32489,7 +33349,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv); - LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); + LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); CVec_u8Z_free(ret_var); @@ -32510,7 +33370,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemsc return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { unsigned char commitment_txid_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_txid) == 32); (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr); @@ -32525,13 +33385,24 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transactio LDKPublicKey revocation_key_ref; CHECK((*env)->GetArrayLength(env, revocation_key) == 33); (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form); - LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); + LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); Transaction_free(ret_var); return ret_arr; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) { + LDKPublicKey funding_pubkey_ref; + CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33); + (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form); + LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelTransactionParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -32668,7 +33539,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg) { +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv)); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val); + ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg, jclass opt_anchors_arg) { LDKChannelPublicKeys holder_pubkeys_arg_conv; holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1)); holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0); @@ -32684,7 +33573,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv); funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv); - LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv); + LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg); + LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -33009,6 +33899,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionP return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelTransactionParameters this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv); + return ret_val; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKHolderCommitmentTransaction this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -33726,6 +34625,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransactio return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKTrustedCommitmentTransaction this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters) { LDKTrustedCommitmentTransaction this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -33807,6 +34715,19 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv return ret_val; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKChannelTypeFeatures a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + LDKChannelTypeFeatures b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv); + return ret_val; +} + static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) { LDKInitFeatures ret_var = InitFeatures_clone(arg); uint64_t ret_ref = 0; @@ -33959,6 +34880,44 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIE return ret_ref; } +static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); +uint64_t ret_ref = 0; +CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uint64_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKChannelTypeFeatures arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelTypeFeatures orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKInitFeatures this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -33991,6 +34950,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv * InvoiceFeatures_free(this_obj_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelTypeFeatures this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ChannelTypeFeatures_free(this_obj_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) { LDKInitFeatures ret_var = InitFeatures_empty(); uint64_t ret_ref = 0; @@ -34131,30 +35098,38 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_ return ret_val; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInitFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNodeFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInvoiceFeatures this_arg_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv); + jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv); return ret_val; } @@ -34170,16 +35145,14 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNI return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKNodeFeatures obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = InitFeatures_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { @@ -34194,28 +35167,28 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write( return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKInvoiceFeatures obj_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); + *ret_conv = ChannelFeatures_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKNodeFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); CVec_u8Z_free(ret_var); return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = (*env)->GetArrayLength(env, ser); - ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = InitFeatures_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); @@ -34226,22 +35199,46 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv * return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKInvoiceFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); - *ret_conv = ChannelFeatures_read(ser_ref); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = InvoiceFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelTypeFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = InvoiceFeatures_read(ser_ref); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } @@ -34520,55 +35517,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass Type_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if ((this_ptr & 1) != 0) return; - void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); - CHECK_ACCESS(this_ptr_ptr); - LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); - FREE((void*)this_ptr); - Score_free(this_ptr_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKLockableScore this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - LockableScore_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1new(JNIEnv *env, jclass clz, int64_t score) { - void* score_ptr = (void*)(((uint64_t)score) & ~1); - CHECK_ACCESS(score_ptr); - LDKScore score_conv = *(LDKScore*)(score_ptr); - if (score_conv.free == LDKScore_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKScore_JCalls_cloned(&score_conv); - } - LDKLockableScore ret_var = LockableScore_new(score_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKLockableScore obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -35361,53 +36309,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t node_one_arg, int64_t one_to_two_arg, int64_t node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) { - LDKChannelFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv); - features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKNodeId node_one_arg_conv; - node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); - node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_one_arg_conv); - node_one_arg_conv = NodeId_clone(&node_one_arg_conv); - LDKDirectionalChannelInfo one_to_two_arg_conv; - one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); - one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(one_to_two_arg_conv); - one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKNodeId node_two_arg_conv; - node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); - node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_two_arg_conv); - node_two_arg_conv = NodeId_clone(&node_two_arg_conv); - LDKDirectionalChannelInfo two_to_one_arg_conv; - two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); - two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(two_to_one_arg_conv); - two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); - void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1); - CHECK_ACCESS(capacity_sats_arg_ptr); - LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr); - capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); - LDKChannelAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv); - announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) { LDKChannelInfo ret_var = ChannelInfo_clone(arg); uint64_t ret_ref = 0; @@ -36201,6 +37102,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEn NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -37656,6 +38565,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + LockableScore_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKMultiThreadedLockableScore this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + MultiThreadedLockableScore_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) { + void* score_ptr = (void*)(((uint64_t)score) & ~1); + CHECK_ACCESS(score_ptr); + LDKScore score_conv = *(LDKScore*)(score_ptr); + if (score_conv.free == LDKScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKScore_JCalls_cloned(&score_conv); + } + LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -37706,6 +38661,40 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failur ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val); } +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -37723,8 +38712,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failur ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) { - LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) { + LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39657,6 +40646,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_ return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount()); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { LDKCreationError* a_conv = (LDKCreationError*)(a & ~1); LDKCreationError* b_conv = (LDKCreationError*)(b & ~1); @@ -40001,7 +40995,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *e // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKRouter_JCalls_cloned(&router_conv); } - LDKLockableScore scorer_conv; + LDKMultiThreadedLockableScore scorer_conv; scorer_conv.inner = (void*)(scorer & (~1)); scorer_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv); @@ -40064,6 +41058,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1va return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); + (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); diff --git a/src/main/jni/bindings.c.body b/src/main/jni/bindings.c.body index 869ef719..2a80cbf4 100644 --- a/src/main/jni/bindings.c.body +++ b/src/main/jni/bindings.c.body @@ -7,6 +7,9 @@ #include #include +#define LIKELY(v) __builtin_expect(!!(v), 1) +#define UNLIKELY(v) __builtin_expect(!!(v), 0) + #define DEBUG_PRINT(...) fprintf(stderr, __VA_ARGS__) #define MALLOC(a, _) malloc(a) #define FREE(p) if ((uint64_t)(p) > 4096) { free(p); } @@ -151,11 +154,17 @@ JNIEXPORT void Java_org_ldk_impl_bindings_init_1class_1cache(JNIEnv * env, jclas } static inline struct LDKThirtyTwoBytes ThirtyTwoBytes_clone(const struct LDKThirtyTwoBytes *orig) { struct LDKThirtyTwoBytes ret; memcpy(ret.data, orig->data, 32); return ret; } static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to AccessError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKAccessError_UnknownChain; case 1: return LDKAccessError_UnknownTx; } - abort(); + (*env)->FatalError(env, "A call to AccessError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass AccessError_class = NULL; static jfieldID AccessError_LDKAccessError_UnknownChain = NULL; @@ -178,12 +187,52 @@ static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) { } } +static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_java(JNIEnv *env, jclass clz) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKCOption_NoneZ_Some; + case 1: return LDKCOption_NoneZ_None; + } + (*env)->FatalError(env, "A call to COption_NoneZ.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here +} +static jclass COption_NoneZ_class = NULL; +static jfieldID COption_NoneZ_LDKCOption_NoneZ_Some = NULL; +static jfieldID COption_NoneZ_LDKCOption_NoneZ_None = NULL; +JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init (JNIEnv *env, jclass clz) { + COption_NoneZ_class = (*env)->NewGlobalRef(env, clz); + CHECK(COption_NoneZ_class != NULL); + COption_NoneZ_LDKCOption_NoneZ_Some = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_Some", "Lorg/ldk/enums/COption_NoneZ;"); + CHECK(COption_NoneZ_LDKCOption_NoneZ_Some != NULL); + COption_NoneZ_LDKCOption_NoneZ_None = (*env)->GetStaticFieldID(env, COption_NoneZ_class, "LDKCOption_NoneZ_None", "Lorg/ldk/enums/COption_NoneZ;"); + CHECK(COption_NoneZ_LDKCOption_NoneZ_None != NULL); +} +static inline jclass LDKCOption_NoneZ_to_java(JNIEnv *env, LDKCOption_NoneZ val) { + switch (val) { + case LDKCOption_NoneZ_Some: + return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_Some); + case LDKCOption_NoneZ_None: + return (*env)->GetStaticObjectField(env, COption_NoneZ_class, COption_NoneZ_LDKCOption_NoneZ_None); + default: abort(); + } +} + static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure; case 1: return LDKChannelMonitorUpdateErr_PermanentFailure; } - abort(); + (*env)->FatalError(env, "A call to ChannelMonitorUpdateErr.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass ChannelMonitorUpdateErr_class = NULL; static jfieldID ChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL; @@ -207,12 +256,18 @@ static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelM } static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKConfirmationTarget_Background; case 1: return LDKConfirmationTarget_Normal; case 2: return LDKConfirmationTarget_HighPriority; } - abort(); + (*env)->FatalError(env, "A call to ConfirmationTarget.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass ConfirmationTarget_class = NULL; static jfieldID ConfirmationTarget_LDKConfirmationTarget_Background = NULL; @@ -241,19 +296,27 @@ static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationT } static inline LDKCreationError LDKCreationError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to CreationError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKCreationError_DescriptionTooLong; case 1: return LDKCreationError_RouteTooLong; case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_ExpiryTimeOutOfBounds; + case 4: return LDKCreationError_InvalidAmount; } - abort(); + (*env)->FatalError(env, "A call to CreationError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass CreationError_class = NULL; static jfieldID CreationError_LDKCreationError_DescriptionTooLong = NULL; static jfieldID CreationError_LDKCreationError_RouteTooLong = NULL; static jfieldID CreationError_LDKCreationError_TimestampOutOfBounds = NULL; static jfieldID CreationError_LDKCreationError_ExpiryTimeOutOfBounds = NULL; +static jfieldID CreationError_LDKCreationError_InvalidAmount = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclass clz) { CreationError_class = (*env)->NewGlobalRef(env, clz); CHECK(CreationError_class != NULL); @@ -265,6 +328,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_CreationError_init (JNIEnv *env, jclas CHECK(CreationError_LDKCreationError_TimestampOutOfBounds != NULL); CreationError_LDKCreationError_ExpiryTimeOutOfBounds = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_ExpiryTimeOutOfBounds", "Lorg/ldk/enums/CreationError;"); CHECK(CreationError_LDKCreationError_ExpiryTimeOutOfBounds != NULL); + CreationError_LDKCreationError_InvalidAmount = (*env)->GetStaticFieldID(env, CreationError_class, "LDKCreationError_InvalidAmount", "Lorg/ldk/enums/CreationError;"); + CHECK(CreationError_LDKCreationError_InvalidAmount != NULL); } static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) { switch (val) { @@ -276,19 +341,27 @@ static inline jclass LDKCreationError_to_java(JNIEnv *env, LDKCreationError val) return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_TimestampOutOfBounds); case LDKCreationError_ExpiryTimeOutOfBounds: return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_ExpiryTimeOutOfBounds); + case LDKCreationError_InvalidAmount: + return (*env)->GetStaticObjectField(env, CreationError_class, CreationError_LDKCreationError_InvalidAmount); default: abort(); } } static inline LDKCurrency LDKCurrency_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Currency.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKCurrency_Bitcoin; case 1: return LDKCurrency_BitcoinTestnet; case 2: return LDKCurrency_Regtest; case 3: return LDKCurrency_Simnet; case 4: return LDKCurrency_Signet; } - abort(); + (*env)->FatalError(env, "A call to Currency.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Currency_class = NULL; static jfieldID Currency_LDKCurrency_Bitcoin = NULL; @@ -327,7 +400,12 @@ static inline jclass LDKCurrency_to_java(JNIEnv *env, LDKCurrency val) { } static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to IOError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKIOError_NotFound; case 1: return LDKIOError_PermissionDenied; case 2: return LDKIOError_ConnectionRefused; @@ -347,7 +425,8 @@ static inline LDKIOError LDKIOError_from_java(JNIEnv *env, jclass clz) { case 16: return LDKIOError_Other; case 17: return LDKIOError_UnexpectedEof; } - abort(); + (*env)->FatalError(env, "A call to IOError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass IOError_class = NULL; static jfieldID IOError_LDKIOError_NotFound = NULL; @@ -451,16 +530,24 @@ static inline jclass LDKIOError_to_java(JNIEnv *env, LDKIOError val) { } static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { - case 0: return LDKLevel_Trace; - case 1: return LDKLevel_Debug; - case 2: return LDKLevel_Info; - case 3: return LDKLevel_Warn; - case 4: return LDKLevel_Error; + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Level.ordinal() from rust threw an exception."); + } + switch (ord) { + case 0: return LDKLevel_Gossip; + case 1: return LDKLevel_Trace; + case 2: return LDKLevel_Debug; + case 3: return LDKLevel_Info; + case 4: return LDKLevel_Warn; + case 5: return LDKLevel_Error; } - abort(); + (*env)->FatalError(env, "A call to Level.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Level_class = NULL; +static jfieldID Level_LDKLevel_Gossip = NULL; static jfieldID Level_LDKLevel_Trace = NULL; static jfieldID Level_LDKLevel_Debug = NULL; static jfieldID Level_LDKLevel_Info = NULL; @@ -469,6 +556,8 @@ static jfieldID Level_LDKLevel_Error = NULL; JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) { Level_class = (*env)->NewGlobalRef(env, clz); CHECK(Level_class != NULL); + Level_LDKLevel_Gossip = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Gossip", "Lorg/ldk/enums/Level;"); + CHECK(Level_LDKLevel_Gossip != NULL); Level_LDKLevel_Trace = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Trace", "Lorg/ldk/enums/Level;"); CHECK(Level_LDKLevel_Trace != NULL); Level_LDKLevel_Debug = (*env)->GetStaticFieldID(env, Level_class, "LDKLevel_Debug", "Lorg/ldk/enums/Level;"); @@ -482,6 +571,8 @@ JNIEXPORT void JNICALL Java_org_ldk_enums_Level_init (JNIEnv *env, jclass clz) { } static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) { switch (val) { + case LDKLevel_Gossip: + return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Gossip); case LDKLevel_Trace: return (*env)->GetStaticObjectField(env, Level_class, Level_LDKLevel_Trace); case LDKLevel_Debug: @@ -497,13 +588,19 @@ static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) { } static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Network.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKNetwork_Bitcoin; case 1: return LDKNetwork_Testnet; case 2: return LDKNetwork_Regtest; case 3: return LDKNetwork_Signet; } - abort(); + (*env)->FatalError(env, "A call to Network.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Network_class = NULL; static jfieldID Network_LDKNetwork_Bitcoin = NULL; @@ -537,7 +634,12 @@ static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) { } static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKSecp256k1Error_IncorrectSignature; case 1: return LDKSecp256k1Error_InvalidMessage; case 2: return LDKSecp256k1Error_InvalidPublicKey; @@ -548,7 +650,8 @@ static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass case 7: return LDKSecp256k1Error_TweakCheckFailed; case 8: return LDKSecp256k1Error_NotEnoughMemory; } - abort(); + (*env)->FatalError(env, "A call to Secp256k1Error.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass Secp256k1Error_class = NULL; static jfieldID Secp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL; @@ -607,7 +710,12 @@ static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error va } static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKSemanticError_NoPaymentHash; case 1: return LDKSemanticError_MultiplePaymentHashes; case 2: return LDKSemanticError_NoDescription; @@ -619,7 +727,8 @@ static inline LDKSemanticError LDKSemanticError_from_java(JNIEnv *env, jclass cl case 8: return LDKSemanticError_InvalidSignature; case 9: return LDKSemanticError_ImpreciseAmount; } - abort(); + (*env)->FatalError(env, "A call to SemanticError.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass SemanticError_class = NULL; static jfieldID SemanticError_LDKSemanticError_NoPaymentHash = NULL; @@ -683,13 +792,19 @@ static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) } static inline LDKSiPrefix LDKSiPrefix_from_java(JNIEnv *env, jclass clz) { - switch ((*env)->CallIntMethod(env, clz, ordinal_meth)) { + jint ord = (*env)->CallIntMethod(env, clz, ordinal_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust threw an exception."); + } + switch (ord) { case 0: return LDKSiPrefix_Milli; case 1: return LDKSiPrefix_Micro; case 2: return LDKSiPrefix_Nano; case 3: return LDKSiPrefix_Pico; } - abort(); + (*env)->FatalError(env, "A call to SiPrefix.ordinal() from rust returned an invalid value."); + abort(); // Unreachable, but will let the compiler know we don't return here } static jclass SiPrefix_class = NULL; static jfieldID SiPrefix_LDKSiPrefix_Milli = NULL; @@ -835,12 +950,12 @@ static jclass LDKCOption_u32Z_None_class = NULL; static jmethodID LDKCOption_u32Z_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u32Z_init (JNIEnv *env, jclass clz) { LDKCOption_u32Z_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$Some")); CHECK(LDKCOption_u32Z_Some_class != NULL); LDKCOption_u32Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_Some_class, "", "(I)V"); CHECK(LDKCOption_u32Z_Some_meth != NULL); LDKCOption_u32Z_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u32Z$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u32Z$None")); CHECK(LDKCOption_u32Z_None_class != NULL); LDKCOption_u32Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u32Z_None_class, "", "()V"); CHECK(LDKCOption_u32Z_None_meth != NULL); @@ -1189,12 +1304,12 @@ static jclass LDKCOption_u64Z_None_class = NULL; static jmethodID LDKCOption_u64Z_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u64Z_init (JNIEnv *env, jclass clz) { LDKCOption_u64Z_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$Some")); CHECK(LDKCOption_u64Z_Some_class != NULL); LDKCOption_u64Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_Some_class, "", "(J)V"); CHECK(LDKCOption_u64Z_Some_meth != NULL); LDKCOption_u64Z_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u64Z$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u64Z$None")); CHECK(LDKCOption_u64Z_None_class != NULL); LDKCOption_u64Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u64Z_None_class, "", "()V"); CHECK(LDKCOption_u64Z_None_meth != NULL); @@ -1381,22 +1496,22 @@ static jclass LDKMonitorEvent_UpdateFailed_class = NULL; static jmethodID LDKMonitorEvent_UpdateFailed_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) { LDKMonitorEvent_HTLCEvent_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent")); CHECK(LDKMonitorEvent_HTLCEvent_class != NULL); LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "", "(J)V"); CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL); LDKMonitorEvent_CommitmentTxConfirmed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed")); CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL); LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "", "(J)V"); CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL); LDKMonitorEvent_UpdateCompleted_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateCompleted")); CHECK(LDKMonitorEvent_UpdateCompleted_class != NULL); LDKMonitorEvent_UpdateCompleted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateCompleted_class, "", "(JJ)V"); CHECK(LDKMonitorEvent_UpdateCompleted_meth != NULL); LDKMonitorEvent_UpdateFailed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMonitorEvent$UpdateFailed")); CHECK(LDKMonitorEvent_UpdateFailed_class != NULL); LDKMonitorEvent_UpdateFailed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_UpdateFailed_class, "", "(J)V"); CHECK(LDKMonitorEvent_UpdateFailed_meth != NULL); @@ -1456,12 +1571,12 @@ static jclass LDKCOption_C2Tuple_usizeTransactionZZ_None_class = NULL; static jmethodID LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1C2Tuple_1usizeTransactionZZ_init (JNIEnv *env, jclass clz) { LDKCOption_C2Tuple_usizeTransactionZZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$Some")); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_class != NULL); LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_Some_class, "", "(J)V"); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_Some_meth != NULL); LDKCOption_C2Tuple_usizeTransactionZZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_C2Tuple_usizeTransactionZZ$None")); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_class != NULL); LDKCOption_C2Tuple_usizeTransactionZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_C2Tuple_usizeTransactionZZ_None_class, "", "()V"); CHECK(LDKCOption_C2Tuple_usizeTransactionZZ_None_meth != NULL); @@ -1489,6 +1604,8 @@ static jclass LDKClosureReason_CooperativeClosure_class = NULL; static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL; static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL; static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL; +static jclass LDKClosureReason_FundingTimedOut_class = NULL; +static jmethodID LDKClosureReason_FundingTimedOut_meth = NULL; static jclass LDKClosureReason_ProcessingError_class = NULL; static jmethodID LDKClosureReason_ProcessingError_meth = NULL; static jclass LDKClosureReason_DisconnectedPeer_class = NULL; @@ -1497,37 +1614,42 @@ static jclass LDKClosureReason_OutdatedChannelManager_class = NULL; static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) { LDKClosureReason_CounterpartyForceClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed")); CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL); LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "", "(Ljava/lang/String;)V"); CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL); LDKClosureReason_HolderForceClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$HolderForceClosed")); CHECK(LDKClosureReason_HolderForceClosed_class != NULL); LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "", "()V"); CHECK(LDKClosureReason_HolderForceClosed_meth != NULL); LDKClosureReason_CooperativeClosure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CooperativeClosure")); CHECK(LDKClosureReason_CooperativeClosure_class != NULL); LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "", "()V"); CHECK(LDKClosureReason_CooperativeClosure_meth != NULL); LDKClosureReason_CommitmentTxConfirmed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed")); CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL); LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "", "()V"); CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL); + LDKClosureReason_FundingTimedOut_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$FundingTimedOut")); + CHECK(LDKClosureReason_FundingTimedOut_class != NULL); + LDKClosureReason_FundingTimedOut_meth = (*env)->GetMethodID(env, LDKClosureReason_FundingTimedOut_class, "", "()V"); + CHECK(LDKClosureReason_FundingTimedOut_meth != NULL); LDKClosureReason_ProcessingError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$ProcessingError")); CHECK(LDKClosureReason_ProcessingError_class != NULL); LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "", "(Ljava/lang/String;)V"); CHECK(LDKClosureReason_ProcessingError_meth != NULL); LDKClosureReason_DisconnectedPeer_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer")); CHECK(LDKClosureReason_DisconnectedPeer_class != NULL); LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "", "()V"); CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL); LDKClosureReason_OutdatedChannelManager_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager")); CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL); LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "", "()V"); CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL); @@ -1549,6 +1671,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from case LDKClosureReason_CommitmentTxConfirmed: { return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth); } + case LDKClosureReason_FundingTimedOut: { + return (*env)->NewObject(env, LDKClosureReason_FundingTimedOut_class, LDKClosureReason_FundingTimedOut_meth); + } case LDKClosureReason_ProcessingError: { LDKStr err_str = obj->processing_error.err; jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len); @@ -1569,12 +1694,12 @@ static jclass LDKCOption_ClosureReasonZ_None_class = NULL; static jmethodID LDKCOption_ClosureReasonZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init (JNIEnv *env, jclass clz) { LDKCOption_ClosureReasonZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$Some")); CHECK(LDKCOption_ClosureReasonZ_Some_class != NULL); LDKCOption_ClosureReasonZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_Some_class, "", "(J)V"); CHECK(LDKCOption_ClosureReasonZ_Some_meth != NULL); LDKCOption_ClosureReasonZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_ClosureReasonZ$None")); CHECK(LDKCOption_ClosureReasonZ_None_class != NULL); LDKCOption_ClosureReasonZ_None_meth = (*env)->GetMethodID(env, LDKCOption_ClosureReasonZ_None_class, "", "()V"); CHECK(LDKCOption_ClosureReasonZ_None_meth != NULL); @@ -1617,17 +1742,17 @@ static jclass LDKNetworkUpdate_NodeFailure_class = NULL; static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) { LDKNetworkUpdate_ChannelUpdateMessage_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage")); CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL); LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "", "(J)V"); CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL); LDKNetworkUpdate_ChannelClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed")); CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL); LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "", "(JZ)V"); CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL); LDKNetworkUpdate_NodeFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure")); CHECK(LDKNetworkUpdate_NodeFailure_class != NULL); LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "", "([BZ)V"); CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL); @@ -1661,12 +1786,12 @@ static jclass LDKCOption_NetworkUpdateZ_None_class = NULL; static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) { LDKCOption_NetworkUpdateZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some")); CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL); LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "", "(J)V"); CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL); LDKCOption_NetworkUpdateZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None")); CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL); LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "", "()V"); CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL); @@ -1692,17 +1817,17 @@ static jclass LDKSpendableOutputDescriptor_StaticPaymentOutput_class = NULL; static jmethodID LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv *env, jclass clz) { LDKSpendableOutputDescriptor_StaticOutput_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput")); CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL); LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "", "(JJ)V"); CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL); LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$DelayedPaymentOutput")); CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_class != NULL); LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DelayedPaymentOutput_class, "", "(J)V"); CHECK(LDKSpendableOutputDescriptor_DelayedPaymentOutput_meth != NULL); LDKSpendableOutputDescriptor_StaticPaymentOutput_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticPaymentOutput")); CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_class != NULL); LDKSpendableOutputDescriptor_StaticPaymentOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticPaymentOutput_class, "", "(J)V"); CHECK(LDKSpendableOutputDescriptor_StaticPaymentOutput_meth != NULL); @@ -1754,12 +1879,12 @@ static jclass LDKPaymentPurpose_SpontaneousPayment_class = NULL; static jmethodID LDKPaymentPurpose_SpontaneousPayment_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentPurpose_init (JNIEnv *env, jclass clz) { LDKPaymentPurpose_InvoicePayment_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$InvoicePayment")); CHECK(LDKPaymentPurpose_InvoicePayment_class != NULL); - LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "", "([B[BJ)V"); + LDKPaymentPurpose_InvoicePayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_InvoicePayment_class, "", "([B[B)V"); CHECK(LDKPaymentPurpose_InvoicePayment_meth != NULL); LDKPaymentPurpose_SpontaneousPayment_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentPurpose$SpontaneousPayment")); CHECK(LDKPaymentPurpose_SpontaneousPayment_class != NULL); LDKPaymentPurpose_SpontaneousPayment_meth = (*env)->GetMethodID(env, LDKPaymentPurpose_SpontaneousPayment_class, "", "([B)V"); CHECK(LDKPaymentPurpose_SpontaneousPayment_meth != NULL); @@ -1772,7 +1897,7 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1fro (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->invoice_payment.payment_preimage.data); int8_tArray payment_secret_arr = (*env)->NewByteArray(env, 32); (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->invoice_payment.payment_secret.data); - return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr, obj->invoice_payment.user_payment_id); + return (*env)->NewObject(env, LDKPaymentPurpose_InvoicePayment_class, LDKPaymentPurpose_InvoicePayment_meth, payment_preimage_arr, payment_secret_arr); } case LDKPaymentPurpose_SpontaneousPayment: { int8_tArray spontaneous_payment_arr = (*env)->NewByteArray(env, 32); @@ -1790,6 +1915,8 @@ static jclass LDKEvent_PaymentSent_class = NULL; static jmethodID LDKEvent_PaymentSent_meth = NULL; static jclass LDKEvent_PaymentPathFailed_class = NULL; static jmethodID LDKEvent_PaymentPathFailed_meth = NULL; +static jclass LDKEvent_PaymentFailed_class = NULL; +static jmethodID LDKEvent_PaymentFailed_meth = NULL; static jclass LDKEvent_PendingHTLCsForwardable_class = NULL; static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL; static jclass LDKEvent_SpendableOutputs_class = NULL; @@ -1800,52 +1927,64 @@ static jclass LDKEvent_ChannelClosed_class = NULL; static jmethodID LDKEvent_ChannelClosed_meth = NULL; static jclass LDKEvent_DiscardFunding_class = NULL; static jmethodID LDKEvent_DiscardFunding_meth = NULL; +static jclass LDKEvent_PaymentPathSuccessful_class = NULL; +static jmethodID LDKEvent_PaymentPathSuccessful_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) { LDKEvent_FundingGenerationReady_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$FundingGenerationReady")); CHECK(LDKEvent_FundingGenerationReady_class != NULL); LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "", "([BJ[BJ)V"); CHECK(LDKEvent_FundingGenerationReady_meth != NULL); LDKEvent_PaymentReceived_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentReceived")); CHECK(LDKEvent_PaymentReceived_class != NULL); LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "", "([BJJ)V"); CHECK(LDKEvent_PaymentReceived_meth != NULL); LDKEvent_PaymentSent_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentSent")); CHECK(LDKEvent_PaymentSent_class != NULL); LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "", "([B[B[BJ)V"); CHECK(LDKEvent_PaymentSent_meth != NULL); LDKEvent_PaymentPathFailed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathFailed")); CHECK(LDKEvent_PaymentPathFailed_class != NULL); LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "", "([B[BZJZ[JJJ)V"); CHECK(LDKEvent_PaymentPathFailed_meth != NULL); + LDKEvent_PaymentFailed_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentFailed")); + CHECK(LDKEvent_PaymentFailed_class != NULL); + LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "", "([B[B)V"); + CHECK(LDKEvent_PaymentFailed_meth != NULL); LDKEvent_PendingHTLCsForwardable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable")); CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL); LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "", "(J)V"); CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL); LDKEvent_SpendableOutputs_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$SpendableOutputs")); CHECK(LDKEvent_SpendableOutputs_class != NULL); LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "", "([J)V"); CHECK(LDKEvent_SpendableOutputs_meth != NULL); LDKEvent_PaymentForwarded_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentForwarded;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentForwarded")); CHECK(LDKEvent_PaymentForwarded_class != NULL); LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "", "(JZ)V"); CHECK(LDKEvent_PaymentForwarded_meth != NULL); LDKEvent_ChannelClosed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$ChannelClosed")); CHECK(LDKEvent_ChannelClosed_class != NULL); LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "", "([BJJ)V"); CHECK(LDKEvent_ChannelClosed_meth != NULL); LDKEvent_DiscardFunding_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$DiscardFunding;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$DiscardFunding")); CHECK(LDKEvent_DiscardFunding_class != NULL); LDKEvent_DiscardFunding_meth = (*env)->GetMethodID(env, LDKEvent_DiscardFunding_class, "", "([B[B)V"); CHECK(LDKEvent_DiscardFunding_meth != NULL); + LDKEvent_PaymentPathSuccessful_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKEvent$PaymentPathSuccessful")); + CHECK(LDKEvent_PaymentPathSuccessful_class != NULL); + LDKEvent_PaymentPathSuccessful_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathSuccessful_class, "", "([B[B[J)V"); + CHECK(LDKEvent_PaymentPathSuccessful_meth != NULL); } JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) { LDKEvent *obj = (LDKEvent*)(ptr & ~1); @@ -1905,6 +2044,13 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN } return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_id_arr, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr, short_channel_id_ref, retry_ref); } + case LDKEvent_PaymentFailed: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_failed.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data); + return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_id_arr, payment_hash_arr); + } case LDKEvent_PendingHTLCsForwardable: { return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable); } @@ -1938,6 +2084,27 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JN (*env)->SetByteArrayRegion(env, transaction_arr, 0, transaction_var.datalen, transaction_var.data); return (*env)->NewObject(env, LDKEvent_DiscardFunding_class, LDKEvent_DiscardFunding_meth, channel_id_arr, transaction_arr); } + case LDKEvent_PaymentPathSuccessful: { + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, obj->payment_path_successful.payment_id.data); + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_successful.payment_hash.data); + LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + return (*env)->NewObject(env, LDKEvent_PaymentPathSuccessful_class, LDKEvent_PaymentPathSuccessful_meth, payment_id_arr, payment_hash_arr, path_arr); + } default: abort(); } } @@ -1947,12 +2114,12 @@ static jclass LDKCOption_EventZ_None_class = NULL; static jmethodID LDKCOption_EventZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init (JNIEnv *env, jclass clz) { LDKCOption_EventZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_EventZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$Some")); CHECK(LDKCOption_EventZ_Some_class != NULL); LDKCOption_EventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_Some_class, "", "(J)V"); CHECK(LDKCOption_EventZ_Some_meth != NULL); LDKCOption_EventZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_EventZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_EventZ$None")); CHECK(LDKCOption_EventZ_None_class != NULL); LDKCOption_EventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_EventZ_None_class, "", "()V"); CHECK(LDKCOption_EventZ_None_meth != NULL); @@ -1993,26 +2160,33 @@ static jclass LDKErrorAction_IgnoreError_class = NULL; static jmethodID LDKErrorAction_IgnoreError_meth = NULL; static jclass LDKErrorAction_IgnoreAndLog_class = NULL; static jmethodID LDKErrorAction_IgnoreAndLog_meth = NULL; +static jclass LDKErrorAction_IgnoreDuplicateGossip_class = NULL; +static jmethodID LDKErrorAction_IgnoreDuplicateGossip_meth = NULL; static jclass LDKErrorAction_SendErrorMessage_class = NULL; static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv *env, jclass clz) { LDKErrorAction_DisconnectPeer_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$DisconnectPeer")); CHECK(LDKErrorAction_DisconnectPeer_class != NULL); LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "", "(J)V"); CHECK(LDKErrorAction_DisconnectPeer_meth != NULL); LDKErrorAction_IgnoreError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreError")); CHECK(LDKErrorAction_IgnoreError_class != NULL); LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "", "()V"); CHECK(LDKErrorAction_IgnoreError_meth != NULL); LDKErrorAction_IgnoreAndLog_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreAndLog")); CHECK(LDKErrorAction_IgnoreAndLog_class != NULL); LDKErrorAction_IgnoreAndLog_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreAndLog_class, "", "(Lorg/ldk/enums/Level;)V"); CHECK(LDKErrorAction_IgnoreAndLog_meth != NULL); + LDKErrorAction_IgnoreDuplicateGossip_class = + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$IgnoreDuplicateGossip")); + CHECK(LDKErrorAction_IgnoreDuplicateGossip_class != NULL); + LDKErrorAction_IgnoreDuplicateGossip_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreDuplicateGossip_class, "", "()V"); + CHECK(LDKErrorAction_IgnoreDuplicateGossip_meth != NULL); LDKErrorAction_SendErrorMessage_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKErrorAction$SendErrorMessage")); CHECK(LDKErrorAction_SendErrorMessage_class != NULL); LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "", "(J)V"); CHECK(LDKErrorAction_SendErrorMessage_meth != NULL); @@ -2038,6 +2212,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1 jclass ignore_and_log_conv = LDKLevel_to_java(env, obj->ignore_and_log); return (*env)->NewObject(env, LDKErrorAction_IgnoreAndLog_class, LDKErrorAction_IgnoreAndLog_meth, ignore_and_log_conv); } + case LDKErrorAction_IgnoreDuplicateGossip: { + return (*env)->NewObject(env, LDKErrorAction_IgnoreDuplicateGossip_class, LDKErrorAction_IgnoreDuplicateGossip_meth); + } case LDKErrorAction_SendErrorMessage: { LDKErrorMessage msg_var = obj->send_error_message.msg; uint64_t msg_ref = 0; @@ -2090,97 +2267,97 @@ static jclass LDKMessageSendEvent_SendReplyChannelRange_class = NULL; static jmethodID LDKMessageSendEvent_SendReplyChannelRange_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv *env, jclass clz) { LDKMessageSendEvent_SendAcceptChannel_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel")); CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL); LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL); LDKMessageSendEvent_SendOpenChannel_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel")); CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL); LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL); LDKMessageSendEvent_SendFundingCreated_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated")); CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL); LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL); LDKMessageSendEvent_SendFundingSigned_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned")); CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL); LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL); LDKMessageSendEvent_SendFundingLocked_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked")); CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL); LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL); LDKMessageSendEvent_SendAnnouncementSignatures_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures")); CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL); LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL); LDKMessageSendEvent_UpdateHTLCs_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs")); CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL); LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL); LDKMessageSendEvent_SendRevokeAndACK_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK")); CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL); LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL); LDKMessageSendEvent_SendClosingSigned_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned")); CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL); LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL); LDKMessageSendEvent_SendShutdown_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown")); CHECK(LDKMessageSendEvent_SendShutdown_class != NULL); LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL); LDKMessageSendEvent_SendChannelReestablish_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish")); CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL); LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL); LDKMessageSendEvent_BroadcastChannelAnnouncement_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement")); CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL); LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "", "(JJ)V"); CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL); LDKMessageSendEvent_BroadcastNodeAnnouncement_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement")); CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL); LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "", "(J)V"); CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL); LDKMessageSendEvent_BroadcastChannelUpdate_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate")); CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL); LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "", "(J)V"); CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL); LDKMessageSendEvent_SendChannelUpdate_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelUpdate")); CHECK(LDKMessageSendEvent_SendChannelUpdate_class != NULL); LDKMessageSendEvent_SendChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelUpdate_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendChannelUpdate_meth != NULL); LDKMessageSendEvent_HandleError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$HandleError")); CHECK(LDKMessageSendEvent_HandleError_class != NULL); LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_HandleError_meth != NULL); LDKMessageSendEvent_SendChannelRangeQuery_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery")); CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL); LDKMessageSendEvent_SendChannelRangeQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelRangeQuery_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendChannelRangeQuery_meth != NULL); LDKMessageSendEvent_SendShortIdsQuery_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendShortIdsQuery")); CHECK(LDKMessageSendEvent_SendShortIdsQuery_class != NULL); LDKMessageSendEvent_SendShortIdsQuery_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShortIdsQuery_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendShortIdsQuery_meth != NULL); LDKMessageSendEvent_SendReplyChannelRange_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKMessageSendEvent$SendReplyChannelRange")); CHECK(LDKMessageSendEvent_SendReplyChannelRange_class != NULL); LDKMessageSendEvent_SendReplyChannelRange_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendReplyChannelRange_class, "", "([BJ)V"); CHECK(LDKMessageSendEvent_SendReplyChannelRange_meth != NULL); @@ -2402,10 +2579,10 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInitFeatures res_var = (*val->contents.result); + LDKScoringParameters res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2413,8 +2590,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDec res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2424,10 +2601,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDec err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKNodeFeatures res_var = (*val->contents.result); + LDKScorer res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2435,8 +2612,30 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDec res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKInitFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var); + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2468,10 +2667,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeatures err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInvoiceFeatures res_var = (*val->contents.result); + LDKNodeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2479,8 +2678,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeatures res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2490,10 +2689,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeatures err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScoringParameters res_var = (*val->contents.result); + LDKInvoiceFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2501,8 +2700,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParamete res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2512,10 +2711,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParamete err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScorer res_var = (*val->contents.result); + LDKChannelTypeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -2523,8 +2722,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErr res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2706,7 +2905,7 @@ LDKPublicKey get_per_commitment_point_LDKBaseSign_jcall(const void* this_arg, ui jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_per_commitment_point in LDKBaseSign from rust threw an exception."); } @@ -2730,7 +2929,7 @@ LDKThirtyTwoBytes release_commitment_secret_LDKBaseSign_jcall(const void* this_a jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to release_commitment_secret in LDKBaseSign from rust threw an exception."); } @@ -2764,7 +2963,7 @@ LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* th jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception."); } @@ -2789,7 +2988,7 @@ LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->channel_keys_id_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_keys_id in LDKBaseSign from rust threw an exception."); } @@ -2823,7 +3022,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment_L jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_commitment_meth, commitment_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_counterparty_commitment in LDKBaseSign from rust threw an exception."); } @@ -2850,7 +3049,7 @@ LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const vo jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception."); } @@ -2885,7 +3084,7 @@ LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_and_htlcs_meth, commitment_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_holder_commitment_and_htlcs in LDKBaseSign from rust threw an exception."); } @@ -2916,7 +3115,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_output_LDKBaseSign_jcall(const vo jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_output_meth, justice_tx_arr, input, amount, per_commitment_key_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_justice_revoked_output in LDKBaseSign from rust threw an exception."); } @@ -2957,7 +3156,7 @@ LDKCResult_SignatureNoneZ sign_justice_revoked_htlc_LDKBaseSign_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_justice_revoked_htlc_meth, justice_tx_arr, input, amount, per_commitment_key_arr, htlc_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_justice_revoked_htlc in LDKBaseSign from rust threw an exception."); } @@ -2998,7 +3197,7 @@ LDKCResult_SignatureNoneZ sign_counterparty_htlc_transaction_LDKBaseSign_jcall(c jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_counterparty_htlc_transaction_meth, htlc_tx_arr, input, amount, per_commitment_point_arr, htlc_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_counterparty_htlc_transaction in LDKBaseSign from rust threw an exception."); } @@ -3033,7 +3232,7 @@ LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception."); } @@ -3068,7 +3267,7 @@ LDKCResult_SignatureNoneZ sign_channel_announcement_LDKBaseSign_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_channel_announcement in LDKBaseSign from rust threw an exception."); } @@ -3103,7 +3302,7 @@ void ready_channel_LDKBaseSign_jcall(void* this_arg, const LDKChannelTransaction jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->ready_channel_meth, channel_parameters_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to ready_channel in LDKBaseSign from rust threw an exception."); } @@ -3410,7 +3609,7 @@ LDKCVec_u8Z write_LDKSign_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to write in LDKSign from rust threw an exception."); } @@ -3637,12 +3836,12 @@ static jclass LDKCOption_u16Z_None_class = NULL; static jmethodID LDKCOption_u16Z_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1u16Z_init (JNIEnv *env, jclass clz) { LDKCOption_u16Z_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$Some")); CHECK(LDKCOption_u16Z_Some_class != NULL); LDKCOption_u16Z_Some_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_Some_class, "", "(S)V"); CHECK(LDKCOption_u16Z_Some_meth != NULL); LDKCOption_u16Z_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_u16Z$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_u16Z$None")); CHECK(LDKCOption_u16Z_None_class != NULL); LDKCOption_u16Z_None_meth = (*env)->GetMethodID(env, LDKCOption_u16Z_None_class, "", "()V"); CHECK(LDKCOption_u16Z_None_meth != NULL); @@ -3673,32 +3872,32 @@ static jclass LDKAPIError_IncompatibleShutdownScript_class = NULL; static jmethodID LDKAPIError_IncompatibleShutdownScript_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv *env, jclass clz) { LDKAPIError_APIMisuseError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$APIMisuseError")); CHECK(LDKAPIError_APIMisuseError_class != NULL); LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "", "(Ljava/lang/String;)V"); CHECK(LDKAPIError_APIMisuseError_meth != NULL); LDKAPIError_FeeRateTooHigh_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh")); CHECK(LDKAPIError_FeeRateTooHigh_class != NULL); LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "", "(Ljava/lang/String;I)V"); CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL); LDKAPIError_RouteError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$RouteError")); CHECK(LDKAPIError_RouteError_class != NULL); LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "", "(Ljava/lang/String;)V"); CHECK(LDKAPIError_RouteError_meth != NULL); LDKAPIError_ChannelUnavailable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$ChannelUnavailable")); CHECK(LDKAPIError_ChannelUnavailable_class != NULL); LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "", "(Ljava/lang/String;)V"); CHECK(LDKAPIError_ChannelUnavailable_meth != NULL); LDKAPIError_MonitorUpdateFailed_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed")); CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL); LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "", "()V"); CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL); LDKAPIError_IncompatibleShutdownScript_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKAPIError$IncompatibleShutdownScript")); CHECK(LDKAPIError_IncompatibleShutdownScript_class != NULL); LDKAPIError_IncompatibleShutdownScript_meth = (*env)->GetMethodID(env, LDKAPIError_IncompatibleShutdownScript_class, "", "(J)V"); CHECK(LDKAPIError_IncompatibleShutdownScript_meth != NULL); @@ -3789,22 +3988,22 @@ static jclass LDKPaymentSendFailure_PartialFailure_class = NULL; static jmethodID LDKPaymentSendFailure_PartialFailure_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentSendFailure_init (JNIEnv *env, jclass clz) { LDKPaymentSendFailure_ParameterError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$ParameterError")); CHECK(LDKPaymentSendFailure_ParameterError_class != NULL); LDKPaymentSendFailure_ParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_ParameterError_class, "", "(J)V"); CHECK(LDKPaymentSendFailure_ParameterError_meth != NULL); LDKPaymentSendFailure_PathParameterError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PathParameterError")); CHECK(LDKPaymentSendFailure_PathParameterError_class != NULL); LDKPaymentSendFailure_PathParameterError_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PathParameterError_class, "", "([J)V"); CHECK(LDKPaymentSendFailure_PathParameterError_meth != NULL); LDKPaymentSendFailure_AllFailedRetrySafe_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$AllFailedRetrySafe")); CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_class != NULL); LDKPaymentSendFailure_AllFailedRetrySafe_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_AllFailedRetrySafe_class, "", "([J)V"); CHECK(LDKPaymentSendFailure_AllFailedRetrySafe_meth != NULL); LDKPaymentSendFailure_PartialFailure_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentSendFailure$PartialFailure")); CHECK(LDKPaymentSendFailure_PartialFailure_class != NULL); LDKPaymentSendFailure_PartialFailure_meth = (*env)->GetMethodID(env, LDKPaymentSendFailure_PartialFailure_class, "", "([JJ[B)V"); CHECK(LDKPaymentSendFailure_PartialFailure_meth != NULL); @@ -3937,22 +4136,22 @@ static jclass LDKNetAddress_OnionV3_class = NULL; static jmethodID LDKNetAddress_OnionV3_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv *env, jclass clz) { LDKNetAddress_IPv4_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv4")); CHECK(LDKNetAddress_IPv4_class != NULL); LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "", "([BS)V"); CHECK(LDKNetAddress_IPv4_meth != NULL); LDKNetAddress_IPv6_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$IPv6")); CHECK(LDKNetAddress_IPv6_class != NULL); LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "", "([BS)V"); CHECK(LDKNetAddress_IPv6_meth != NULL); LDKNetAddress_OnionV2_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV2")); CHECK(LDKNetAddress_OnionV2_class != NULL); - LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "", "([BS)V"); + LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "", "([B)V"); CHECK(LDKNetAddress_OnionV2_meth != NULL); LDKNetAddress_OnionV3_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKNetAddress$OnionV3")); CHECK(LDKNetAddress_OnionV3_class != NULL); LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "", "([BSBS)V"); CHECK(LDKNetAddress_OnionV3_meth != NULL); @@ -3971,9 +4170,9 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1p return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port); } case LDKNetAddress_OnionV2: { - int8_tArray addr_arr = (*env)->NewByteArray(env, 10); - (*env)->SetByteArrayRegion(env, addr_arr, 0, 10, obj->onion_v2.addr.data); - return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port); + int8_tArray onion_v2_arr = (*env)->NewByteArray(env, 12); + (*env)->SetByteArrayRegion(env, onion_v2_arr, 0, 12, obj->onion_v2.data); + return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, onion_v2_arr); } case LDKNetAddress_OnionV3: { int8_tArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32); @@ -4010,6 +4209,45 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPay return ret_arr; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1); CHECK(val->result_ok); @@ -4023,6 +4261,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAP uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, res_arr, 0, 32, (*val->contents.result).data); + return res_arr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) { LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -4085,7 +4336,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_LDKWatch_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to watch_channel in LDKWatch from rust threw an exception."); } @@ -4128,7 +4379,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_LDKWatch_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to update_channel in LDKWatch from rust threw an exception."); } @@ -4153,7 +4404,7 @@ LDKCVec_MonitorEventZ release_pending_monitor_events_LDKWatch_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->release_pending_monitor_events_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to release_pending_monitor_events in LDKWatch from rust threw an exception."); } @@ -4306,7 +4557,7 @@ void broadcast_transaction_LDKBroadcasterInterface_jcall(const void* this_arg, L jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to broadcast_transaction in LDKBroadcasterInterface from rust threw an exception."); } @@ -4363,6 +4614,7 @@ typedef struct LDKKeysInterface_JCalls { jmethodID get_secure_random_bytes_meth; jmethodID read_chan_signer_meth; jmethodID sign_invoice_meth; + jmethodID get_inbound_payment_key_material_meth; } LDKKeysInterface_JCalls; static void LDKKeysInterface_JCalls_free(void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -4393,7 +4645,7 @@ LDKSecretKey get_node_secret_LDKKeysInterface_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_node_secret in LDKKeysInterface from rust threw an exception."); } @@ -4417,7 +4669,7 @@ LDKCVec_u8Z get_destination_script_LDKKeysInterface_jcall(const void* this_arg) jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_destination_script_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_destination_script in LDKKeysInterface from rust threw an exception."); } @@ -4442,7 +4694,7 @@ LDKShutdownScript get_shutdown_scriptpubkey_LDKKeysInterface_jcall(const void* t jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_shutdown_scriptpubkey_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_shutdown_scriptpubkey in LDKKeysInterface from rust threw an exception."); } @@ -4467,7 +4719,7 @@ LDKSign get_channel_signer_LDKKeysInterface_jcall(const void* this_arg, bool inb jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_channel_signer_meth, inbound, channel_value_satoshis); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_channel_signer in LDKKeysInterface from rust threw an exception."); } @@ -4492,7 +4744,7 @@ LDKThirtyTwoBytes get_secure_random_bytes_LDKKeysInterface_jcall(const void* thi jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_secure_random_bytes in LDKKeysInterface from rust threw an exception."); } @@ -4519,7 +4771,7 @@ LDKCResult_SignDecodeErrorZ read_chan_signer_LDKKeysInterface_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_chan_signer_meth, reader_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to read_chan_signer in LDKKeysInterface from rust threw an exception."); } @@ -4548,7 +4800,7 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_invoice_meth, invoice_preimage_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sign_invoice in LDKKeysInterface from rust threw an exception."); } @@ -4561,6 +4813,30 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v } return ret_conv; } +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_inbound_payment_key_material_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to get_inbound_payment_key_material in LDKKeysInterface from rust threw an exception."); + } + LDKThirtyTwoBytes ret_ref; + CHECK((*env)->GetArrayLength(env, ret) == 32); + (*env)->GetByteArrayRegion(env, ret, 0, 32, ret_ref.data); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_ref; +} static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -4586,6 +4862,8 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j CHECK(calls->read_chan_signer_meth != NULL); calls->sign_invoice_meth = (*env)->GetMethodID(env, c, "sign_invoice", "([B)J"); CHECK(calls->sign_invoice_meth != NULL); + calls->get_inbound_payment_key_material_meth = (*env)->GetMethodID(env, c, "get_inbound_payment_key_material", "()[B"); + CHECK(calls->get_inbound_payment_key_material_meth != NULL); LDKKeysInterface ret = { .this_arg = (void*) calls, @@ -4596,6 +4874,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv *env, jclass clz, j .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .sign_invoice = sign_invoice_LDKKeysInterface_jcall, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, .free = LDKKeysInterface_JCalls_free, }; return ret; @@ -4685,6 +4964,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoic return (uint64_t)ret_conv; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + int8_tArray ret_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data); + return ret_arr; +} + typedef struct LDKFeeEstimator_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -4721,7 +5009,7 @@ uint32_t get_est_sat_per_1000_weight_LDKFeeEstimator_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int32_t ret = (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_est_sat_per_1000_weight in LDKFeeEstimator from rust threw an exception."); } @@ -4810,7 +5098,7 @@ void log_LDKLogger_jcall(const void* this_arg, const LDKRecord * record) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to log in LDKLogger from rust threw an exception."); } @@ -4967,7 +5255,7 @@ uint16_t type_id_LDKType_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception."); } @@ -4988,7 +5276,7 @@ LDKStr debug_str_LDKType_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception."); } @@ -5010,7 +5298,7 @@ LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception."); } @@ -5091,12 +5379,12 @@ static jclass LDKCOption_TypeZ_None_class = NULL; static jmethodID LDKCOption_TypeZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) { LDKCOption_TypeZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$Some")); CHECK(LDKCOption_TypeZ_Some_class != NULL); LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "", "(J)V"); CHECK(LDKCOption_TypeZ_Some_meth != NULL); LDKCOption_TypeZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_TypeZ$None")); CHECK(LDKCOption_TypeZ_None_class != NULL); LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "", "()V"); CHECK(LDKCOption_TypeZ_None_meth != NULL); @@ -5140,17 +5428,17 @@ static jclass LDKPaymentError_Sending_class = NULL; static jmethodID LDKPaymentError_Sending_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKPaymentError_init (JNIEnv *env, jclass clz) { LDKPaymentError_Invoice_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Invoice;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Invoice")); CHECK(LDKPaymentError_Invoice_class != NULL); LDKPaymentError_Invoice_meth = (*env)->GetMethodID(env, LDKPaymentError_Invoice_class, "", "(Ljava/lang/String;)V"); CHECK(LDKPaymentError_Invoice_meth != NULL); LDKPaymentError_Routing_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Routing;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Routing")); CHECK(LDKPaymentError_Routing_class != NULL); LDKPaymentError_Routing_meth = (*env)->GetMethodID(env, LDKPaymentError_Routing_class, "", "(J)V"); CHECK(LDKPaymentError_Routing_meth != NULL); LDKPaymentError_Sending_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKPaymentError$Sending;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKPaymentError$Sending")); CHECK(LDKPaymentError_Sending_class != NULL); LDKPaymentError_Sending_meth = (*env)->GetMethodID(env, LDKPaymentError_Sending_class, "", "(J)V"); CHECK(LDKPaymentError_Sending_meth != NULL); @@ -5440,12 +5728,12 @@ static jclass LDKCOption_MonitorEventZ_None_class = NULL; static jmethodID LDKCOption_MonitorEventZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init (JNIEnv *env, jclass clz) { LDKCOption_MonitorEventZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$Some")); CHECK(LDKCOption_MonitorEventZ_Some_class != NULL); LDKCOption_MonitorEventZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_Some_class, "", "(J)V"); CHECK(LDKCOption_MonitorEventZ_Some_meth != NULL); LDKCOption_MonitorEventZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_MonitorEventZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_MonitorEventZ$None")); CHECK(LDKCOption_MonitorEventZ_None_class != NULL); LDKCOption_MonitorEventZ_None_meth = (*env)->GetMethodID(env, LDKCOption_MonitorEventZ_None_class, "", "()V"); CHECK(LDKCOption_MonitorEventZ_None_meth != NULL); @@ -5502,22 +5790,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecod err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(val->result_ok); - return *val->contents.result; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(!val->result_ok); - LDKMonitorUpdateError err_var = (*val->contents.err); - uint64_t err_ref = 0; - CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); - err_ref = (uint64_t)err_var.inner & ~1; - return err_ref; -} static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){ return OutPoint_clone(&tuple->a); } @@ -5690,22 +5962,22 @@ static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL; static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) { LDKBalance_ClaimableOnChannelClose_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose")); CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL); LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "", "(J)V"); CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL); LDKBalance_ClaimableAwaitingConfirmations_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations")); CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL); LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "", "(JI)V"); CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL); LDKBalance_ContentiousClaimable_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$ContentiousClaimable")); CHECK(LDKBalance_ContentiousClaimable_class != NULL); LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "", "(JI)V"); CHECK(LDKBalance_ContentiousClaimable_meth != NULL); LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout")); CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL); LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "", "(JI)V"); CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL); @@ -6005,7 +6277,7 @@ LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, cons jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception."); } @@ -6063,12 +6335,12 @@ static jclass LDKCOption_AccessZ_None_class = NULL; static jmethodID LDKCOption_AccessZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) { LDKCOption_AccessZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$Some")); CHECK(LDKCOption_AccessZ_Some_class != NULL); LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "", "(J)V"); CHECK(LDKCOption_AccessZ_Some_meth != NULL); LDKCOption_AccessZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_AccessZ$None")); CHECK(LDKCOption_AccessZ_None_class != NULL); LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "", "()V"); CHECK(LDKCOption_AccessZ_None_meth != NULL); @@ -6235,12 +6507,12 @@ static jclass LDKCOption_CVec_NetAddressZZ_None_class = NULL; static jmethodID LDKCOption_CVec_NetAddressZZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1CVec_1NetAddressZZ_init (JNIEnv *env, jclass clz) { LDKCOption_CVec_NetAddressZZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$Some")); CHECK(LDKCOption_CVec_NetAddressZZ_Some_class != NULL); LDKCOption_CVec_NetAddressZZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_Some_class, "", "([J)V"); CHECK(LDKCOption_CVec_NetAddressZZ_Some_meth != NULL); LDKCOption_CVec_NetAddressZZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_CVec_NetAddressZZ$None")); CHECK(LDKCOption_CVec_NetAddressZZ_None_class != NULL); LDKCOption_CVec_NetAddressZZ_None_meth = (*env)->GetMethodID(env, LDKCOption_CVec_NetAddressZZ_None_class, "", "()V"); CHECK(LDKCOption_CVec_NetAddressZZ_None_meth != NULL); @@ -7021,12 +7293,12 @@ static jclass LDKSignOrCreationError_CreationError_class = NULL; static jmethodID LDKSignOrCreationError_CreationError_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSignOrCreationError_init (JNIEnv *env, jclass clz) { LDKSignOrCreationError_SignError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$SignError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$SignError")); CHECK(LDKSignOrCreationError_SignError_class != NULL); LDKSignOrCreationError_SignError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_SignError_class, "", "()V"); CHECK(LDKSignOrCreationError_SignError_meth != NULL); LDKSignOrCreationError_CreationError_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSignOrCreationError$CreationError;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKSignOrCreationError$CreationError")); CHECK(LDKSignOrCreationError_CreationError_class != NULL); LDKSignOrCreationError_CreationError_meth = (*env)->GetMethodID(env, LDKSignOrCreationError_CreationError_class, "", "(Lorg/ldk/enums/CreationError;)V"); CHECK(LDKSignOrCreationError_CreationError_meth != NULL); @@ -7102,7 +7374,7 @@ void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32 jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception."); } @@ -7131,7 +7403,7 @@ LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception."); } @@ -7209,12 +7481,12 @@ static jclass LDKCOption_FilterZ_None_class = NULL; static jmethodID LDKCOption_FilterZ_None_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) { LDKCOption_FilterZ_Some_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$Some")); CHECK(LDKCOption_FilterZ_Some_class != NULL); LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "", "(J)V"); CHECK(LDKCOption_FilterZ_Some_meth != NULL); LDKCOption_FilterZ_None_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKCOption_FilterZ$None")); CHECK(LDKCOption_FilterZ_None_class != NULL); LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "", "()V"); CHECK(LDKCOption_FilterZ_None_meth != NULL); @@ -7296,7 +7568,7 @@ LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsP jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception."); } @@ -7403,7 +7675,7 @@ void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * e jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception."); } @@ -7482,7 +7754,7 @@ void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEve jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception."); } @@ -7569,7 +7841,7 @@ void block_connected_LDKListen_jcall(const void* this_arg, LDKu8slice block, uin jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->block_connected_meth, block_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to block_connected in LDKListen from rust threw an exception."); } @@ -7591,7 +7863,7 @@ void block_disconnected_LDKListen_jcall(const void* this_arg, const uint8_t (* h jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->block_disconnected_meth, header_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to block_disconnected in LDKListen from rust threw an exception."); } @@ -7701,7 +7973,7 @@ void transactions_confirmed_LDKConfirm_jcall(const void* this_arg, const uint8_t jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->transactions_confirmed_meth, header_arr, txdata_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to transactions_confirmed in LDKConfirm from rust threw an exception."); } @@ -7723,7 +7995,7 @@ void transaction_unconfirmed_LDKConfirm_jcall(const void* this_arg, const uint8_ jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->transaction_unconfirmed_meth, txid_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to transaction_unconfirmed in LDKConfirm from rust threw an exception."); } @@ -7745,7 +8017,7 @@ void best_block_updated_LDKConfirm_jcall(const void* this_arg, const uint8_t (* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->best_block_updated_meth, header_arr, height); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to best_block_updated in LDKConfirm from rust threw an exception."); } @@ -7765,7 +8037,7 @@ LDKCVec_TxidZ get_relevant_txids_LDKConfirm_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); jobjectArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_relevant_txids_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_relevant_txids in LDKConfirm from rust threw an exception."); } @@ -7953,7 +8225,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(con jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_new_channel_meth, channel_id_ref, data_ref, update_id_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to persist_new_channel in LDKPersist from rust threw an exception."); } @@ -8018,7 +8290,7 @@ LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcal jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->update_persisted_channel_meth, channel_id_ref, update_ref, data_ref, update_id_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to update_persisted_channel in LDKPersist from rust threw an exception."); } @@ -8186,7 +8458,7 @@ void handle_open_channel_LDKChannelMessageHandler_jcall(const void* this_arg, LD jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_open_channel in LDKChannelMessageHandler from rust threw an exception."); } @@ -8227,7 +8499,7 @@ void handle_accept_channel_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_accept_channel in LDKChannelMessageHandler from rust threw an exception."); } @@ -8259,7 +8531,7 @@ void handle_funding_created_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_funding_created in LDKChannelMessageHandler from rust threw an exception."); } @@ -8291,7 +8563,7 @@ void handle_funding_signed_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_funding_signed in LDKChannelMessageHandler from rust threw an exception."); } @@ -8323,7 +8595,7 @@ void handle_funding_locked_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_funding_locked in LDKChannelMessageHandler from rust threw an exception."); } @@ -8365,7 +8637,7 @@ void handle_shutdown_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPub jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, their_features_ref, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_shutdown in LDKChannelMessageHandler from rust threw an exception."); } @@ -8397,7 +8669,7 @@ void handle_closing_signed_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_closing_signed in LDKChannelMessageHandler from rust threw an exception."); } @@ -8429,7 +8701,7 @@ void handle_update_add_htlc_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_add_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8461,7 +8733,7 @@ void handle_update_fulfill_htlc_LDKChannelMessageHandler_jcall(const void* this_ jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fulfill_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8493,7 +8765,7 @@ void handle_update_fail_htlc_LDKChannelMessageHandler_jcall(const void* this_arg jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fail_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8525,7 +8797,7 @@ void handle_update_fail_malformed_htlc_LDKChannelMessageHandler_jcall(const void jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fail_malformed_htlc in LDKChannelMessageHandler from rust threw an exception."); } @@ -8557,7 +8829,7 @@ void handle_commitment_signed_LDKChannelMessageHandler_jcall(const void* this_ar jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_commitment_signed in LDKChannelMessageHandler from rust threw an exception."); } @@ -8589,7 +8861,7 @@ void handle_revoke_and_ack_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_revoke_and_ack in LDKChannelMessageHandler from rust threw an exception."); } @@ -8621,7 +8893,7 @@ void handle_update_fee_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_update_fee in LDKChannelMessageHandler from rust threw an exception."); } @@ -8653,7 +8925,7 @@ void handle_announcement_signatures_LDKChannelMessageHandler_jcall(const void* t jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_announcement_signatures in LDKChannelMessageHandler from rust threw an exception."); } @@ -8675,7 +8947,7 @@ void peer_disconnected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKP jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_disconnected in LDKChannelMessageHandler from rust threw an exception."); } @@ -8707,7 +8979,7 @@ void peer_connected_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPubl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to peer_connected in LDKChannelMessageHandler from rust threw an exception."); } @@ -8739,7 +9011,7 @@ void handle_channel_reestablish_LDKChannelMessageHandler_jcall(const void* this_ jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_reestablish in LDKChannelMessageHandler from rust threw an exception."); } @@ -8771,7 +9043,7 @@ void handle_channel_update_LDKChannelMessageHandler_jcall(const void* this_arg, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_update_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_update in LDKChannelMessageHandler from rust threw an exception."); } @@ -8803,7 +9075,7 @@ void handle_error_LDKChannelMessageHandler_jcall(const void* this_arg, LDKPublic jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_error in LDKChannelMessageHandler from rust threw an exception."); } @@ -9248,7 +9520,7 @@ LDKCResult_boolLightningErrorZ handle_node_announcement_LDKRoutingMessageHandler jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_node_announcement in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9283,7 +9555,7 @@ LDKCResult_boolLightningErrorZ handle_channel_announcement_LDKRoutingMessageHand jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_announcement in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9318,7 +9590,7 @@ LDKCResult_boolLightningErrorZ handle_channel_update_LDKRoutingMessageHandler_jc jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_channel_update in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9343,7 +9615,7 @@ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_next_channel_announcements in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9382,7 +9654,7 @@ LDKCVec_NodeAnnouncementZ get_next_node_announcements_LDKRoutingMessageHandler_j jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_next_node_announcements in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9431,7 +9703,7 @@ void sync_routing_table_LDKRoutingMessageHandler_jcall(const void* this_arg, LDK jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->sync_routing_table_meth, their_node_id_arr, init_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to sync_routing_table in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9462,7 +9734,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_channel_range_LDKRoutingMessageHandl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_channel_range_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_reply_channel_range in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9498,7 +9770,7 @@ LDKCResult_NoneLightningErrorZ handle_reply_short_channel_ids_end_LDKRoutingMess jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_reply_short_channel_ids_end_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_reply_short_channel_ids_end in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9534,7 +9806,7 @@ LDKCResult_NoneLightningErrorZ handle_query_channel_range_LDKRoutingMessageHandl jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_channel_range_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_query_channel_range in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9570,7 +9842,7 @@ LDKCResult_NoneLightningErrorZ handle_query_short_channel_ids_LDKRoutingMessageH jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_query_short_channel_ids_meth, their_node_id_arr, msg_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_query_short_channel_ids in LDKRoutingMessageHandler from rust threw an exception."); } @@ -9850,7 +10122,7 @@ LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const voi jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception."); } @@ -9943,7 +10215,7 @@ LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jca jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception."); } @@ -9968,7 +10240,7 @@ LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandle jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception."); } @@ -10109,7 +10381,7 @@ uintptr_t send_data_LDKSocketDescriptor_jcall(void* this_arg, LDKu8slice data, b jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to send_data in LDKSocketDescriptor from rust threw an exception."); } @@ -10130,7 +10402,7 @@ void disconnect_socket_LDKSocketDescriptor_jcall(void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to disconnect_socket in LDKSocketDescriptor from rust threw an exception."); } @@ -10152,7 +10424,7 @@ bool eq_LDKSocketDescriptor_jcall(const void* this_arg, const LDKSocketDescripto jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); jboolean ret = (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, (uint64_t)other_arg_clone); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to eq in LDKSocketDescriptor from rust threw an exception."); } @@ -10173,7 +10445,7 @@ uint64_t hash_LDKSocketDescriptor_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->hash_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to hash in LDKSocketDescriptor from rust threw an exception."); } @@ -10251,6 +10523,7 @@ typedef struct LDKScore_JCalls { jweak o; jmethodID channel_penalty_msat_meth; jmethodID payment_path_failed_meth; + jmethodID payment_path_successful_meth; jmethodID write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { @@ -10270,7 +10543,7 @@ static void LDKScore_JCalls_free(void* this_arg) { FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -10279,6 +10552,9 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } else { DO_ASSERT(get_jenv_res == JNI_OK); } + LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *channel_capacity_msat_copy = channel_capacity_msat; + uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy; LDKNodeId source_var = *source; uint64_t source_ref = 0; source_var = NodeId_clone(source); @@ -10301,8 +10577,8 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor } jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref); - if ((*env)->ExceptionCheck(env)) { + int64_t ret = (*env)->CallLongMethod(env, obj, j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref); + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to channel_penalty_msat in LDKScore from rust threw an exception."); } @@ -10341,7 +10617,7 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); (*env)->CallVoidMethod(env, obj, j_calls->payment_path_failed_meth, path_arr, short_channel_id); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to payment_path_failed in LDKScore from rust threw an exception."); } @@ -10349,6 +10625,44 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); } } +void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKCVec_RouteHopZ path_var = path; + int64_tArray path_arr = NULL; + path_arr = (*env)->NewLongArray(env, path_var.datalen); + int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0); + FREE(path_var.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->payment_path_successful_meth, path_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to payment_path_successful in LDKScore from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; JNIEnv *env; @@ -10361,7 +10675,7 @@ LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to write in LDKScore from rust threw an exception."); } @@ -10385,10 +10699,12 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJ)J"); + calls->channel_penalty_msat_meth = (*env)->GetMethodID(env, c, "channel_penalty_msat", "(JJJJJ)J"); CHECK(calls->channel_penalty_msat_meth != NULL); calls->payment_path_failed_meth = (*env)->GetMethodID(env, c, "payment_path_failed", "([JJ)V"); CHECK(calls->payment_path_failed_meth != NULL); + calls->payment_path_successful_meth = (*env)->GetMethodID(env, c, "payment_path_successful", "([J)V"); + CHECK(calls->payment_path_successful_meth != NULL); calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B"); CHECK(calls->write_meth != NULL); @@ -10396,6 +10712,7 @@ static inline LDKScore LDKScore_init (JNIEnv *env, jclass clz, jobject o) { .this_arg = (void*) calls, .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, .payment_path_failed = payment_path_failed_LDKScore_jcall, + .payment_path_successful = payment_path_successful_LDKScore_jcall, .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; @@ -10406,10 +10723,14 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKScore_1new(JNIEnv *env, *res_ptr = LDKScore_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t source, int64_t target) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat(JNIEnv *env, jclass clz, int64_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, int64_t channel_capacity_msat, int64_t source, int64_t target) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1); + CHECK_ACCESS(channel_capacity_msat_ptr); + LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr); + channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1)); LDKNodeId source_conv; source_conv.inner = (void*)(source & (~1)); source_conv.is_owned = false; @@ -10418,7 +10739,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1ms target_conv.inner = (void*)(target & (~1)); target_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv); return ret_val; } @@ -10446,6 +10767,30 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed(J (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray path) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr); +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *env, jclass clz, int64_t this_arg) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -10457,6 +10802,93 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Score_1write(JNIEnv *en return ret_arr; } +typedef struct LDKLockableScore_JCalls { + atomic_size_t refcnt; + JavaVM *vm; + jweak o; + jmethodID lock_meth; +} LDKLockableScore_JCalls; +static void LDKLockableScore_JCalls_free(void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + (*env)->DeleteWeakGlobalRef(env, j_calls->o); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + FREE(j_calls); + } +} +LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->lock_meth); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to lock in LDKLockableScore from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKScore ret_conv = *(LDKScore*)(ret_ptr); + if (ret_conv.free == LDKScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKScore_JCalls_cloned(&ret_conv); + }// Warning: we may need a move here but no clone is available for LDKScore + + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} +static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKLockableScore LDKLockableScore_init (JNIEnv *env, jclass clz, jobject o) { + jclass c = (*env)->GetObjectClass(env, o); + CHECK(c != NULL); + LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls"); + atomic_init(&calls->refcnt, 1); + DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); + calls->o = (*env)->NewWeakGlobalRef(env, o); + calls->lock_meth = (*env)->GetMethodID(env, c, "lock", "()J"); + CHECK(calls->lock_meth != NULL); + + LDKLockableScore ret = { + .this_arg = (void*) calls, + .lock = lock_LDKLockableScore_jcall, + .free = LDKLockableScore_JCalls_free, + }; + return ret; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new(JNIEnv *env, jclass clz, jobject o) { + LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore"); + *res_ptr = LDKLockableScore_init(env, clz, o); + return (uint64_t)res_ptr; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock(JNIEnv *env, jclass clz, int64_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr; + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg); + return (uint64_t)ret_ret; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -10502,7 +10934,7 @@ LDKCResult_NoneErrorZ persist_manager_LDKChannelManagerPersister_jcall(const voi jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->persist_manager_meth, channel_manager_ref); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to persist_manager in LDKChannelManagerPersister from rust threw an exception."); } @@ -10562,17 +10994,17 @@ static jclass LDKFallback_ScriptHash_class = NULL; static jmethodID LDKFallback_ScriptHash_meth = NULL; JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKFallback_init (JNIEnv *env, jclass clz) { LDKFallback_SegWitProgram_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$SegWitProgram;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$SegWitProgram")); CHECK(LDKFallback_SegWitProgram_class != NULL); LDKFallback_SegWitProgram_meth = (*env)->GetMethodID(env, LDKFallback_SegWitProgram_class, "", "(B[B)V"); CHECK(LDKFallback_SegWitProgram_meth != NULL); LDKFallback_PubKeyHash_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$PubKeyHash;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$PubKeyHash")); CHECK(LDKFallback_PubKeyHash_class != NULL); LDKFallback_PubKeyHash_meth = (*env)->GetMethodID(env, LDKFallback_PubKeyHash_class, "", "([B)V"); CHECK(LDKFallback_PubKeyHash_meth != NULL); LDKFallback_ScriptHash_class = - (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKFallback$ScriptHash;")); + (*env)->NewGlobalRef(env, (*env)->FindClass(env, "org/ldk/impl/bindings$LDKFallback$ScriptHash")); CHECK(LDKFallback_ScriptHash_class != NULL); LDKFallback_ScriptHash_meth = (*env)->GetMethodID(env, LDKFallback_ScriptHash_class, "", "([B)V"); CHECK(LDKFallback_ScriptHash_meth != NULL); @@ -10607,7 +11039,9 @@ typedef struct LDKPayer_JCalls { jmethodID node_id_meth; jmethodID first_hops_meth; jmethodID send_payment_meth; + jmethodID send_spontaneous_payment_meth; jmethodID retry_payment_meth; + jmethodID abandon_payment_meth; } LDKPayer_JCalls; static void LDKPayer_JCalls_free(void* this_arg) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; @@ -10638,7 +11072,7 @@ LDKPublicKey node_id_LDKPayer_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->node_id_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to node_id in LDKPayer from rust threw an exception."); } @@ -10662,7 +11096,7 @@ LDKCVec_ChannelDetailsZ first_hops_LDKPayer_jcall(const void* this_arg) { jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->first_hops_meth); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to first_hops in LDKPayer from rust threw an exception."); } @@ -10713,7 +11147,7 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_payment_meth, route_ref, payment_hash_arr, payment_secret_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to send_payment in LDKPayer from rust threw an exception."); } @@ -10726,6 +11160,43 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* } return ret_conv; } +LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(route); + CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = (uint64_t)route_var.inner; + if (route_var.is_owned) { + route_ref |= 1; + } + int8_tArray payment_preimage_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, payment_preimage.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to send_spontaneous_payment in LDKPayer from rust threw an exception."); + } + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); + FREE((void*)ret); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } + return ret_conv; +} LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; JNIEnv *env; @@ -10750,7 +11221,7 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->retry_payment_meth, route_ref, payment_id_arr); - if ((*env)->ExceptionCheck(env)) { + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to retry_payment in LDKPayer from rust threw an exception."); } @@ -10763,6 +11234,28 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this } return ret_conv; } +void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + JNIEnv *env; + jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK); + } else { + DO_ASSERT(get_jenv_res == JNI_OK); + } + int8_tArray payment_id_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_id_arr, 0, 32, payment_id.data); + jobject obj = (*env)->NewLocalRef(env, j_calls->o); + CHECK(obj != NULL); + (*env)->CallVoidMethod(env, obj, j_calls->abandon_payment_meth, payment_id_arr); + if (UNLIKELY((*env)->ExceptionCheck(env))) { + (*env)->ExceptionDescribe(env); + (*env)->FatalError(env, "A call to abandon_payment in LDKPayer from rust threw an exception."); + } + if (get_jenv_res == JNI_EDETACHED) { + DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK); + } +} static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -10780,15 +11273,21 @@ static inline LDKPayer LDKPayer_init (JNIEnv *env, jclass clz, jobject o) { CHECK(calls->first_hops_meth != NULL); calls->send_payment_meth = (*env)->GetMethodID(env, c, "send_payment", "(J[B[B)J"); CHECK(calls->send_payment_meth != NULL); + calls->send_spontaneous_payment_meth = (*env)->GetMethodID(env, c, "send_spontaneous_payment", "(J[B)J"); + CHECK(calls->send_spontaneous_payment_meth != NULL); calls->retry_payment_meth = (*env)->GetMethodID(env, c, "retry_payment", "(J[B)J"); CHECK(calls->retry_payment_meth != NULL); + calls->abandon_payment_meth = (*env)->GetMethodID(env, c, "abandon_payment", "([B)V"); + CHECK(calls->abandon_payment_meth != NULL); LDKPayer ret = { .this_arg = (void*) calls, .node_id = node_id_LDKPayer_jcall, .first_hops = first_hops_LDKPayer_jcall, .send_payment = send_payment_LDKPayer_jcall, + .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, .retry_payment = retry_payment_LDKPayer_jcall, + .abandon_payment = abandon_payment_LDKPayer_jcall, .free = LDKPayer_JCalls_free, }; return ret; @@ -10851,6 +11350,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment(JNIEnv return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); + (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_id) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -10867,6 +11382,16 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment(JNIEn return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); +} + typedef struct LDKRouter_JCalls { atomic_size_t refcnt; JavaVM *vm; @@ -10890,7 +11415,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; JNIEnv *env; jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6); @@ -10911,6 +11436,8 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, if (params_var.is_owned) { params_ref |= 1; } + int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32); + (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, *payment_hash); LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; int64_tArray first_hops_arr = NULL; if (first_hops != NULL) { @@ -10935,8 +11462,8 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, uint64_t ret_scorer = ((uint64_t)scorer) | 1; jobject obj = (*env)->NewLocalRef(env, j_calls->o); CHECK(obj != NULL); - uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer); - if ((*env)->ExceptionCheck(env)) { + uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer); + if (UNLIKELY((*env)->ExceptionCheck(env))) { (*env)->ExceptionDescribe(env); (*env)->FatalError(env, "A call to find_route in LDKRouter from rust threw an exception."); } @@ -10960,7 +11487,7 @@ static inline LDKRouter LDKRouter_init (JNIEnv *env, jclass clz, jobject o) { atomic_init(&calls->refcnt, 1); DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0); calls->o = (*env)->NewWeakGlobalRef(env, o); - calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[JJ)J"); + calls->find_route_meth = (*env)->GetMethodID(env, c, "find_route", "([BJ[B[JJ)J"); CHECK(calls->find_route_meth != NULL); LDKRouter ret = { @@ -10975,7 +11502,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new(JNIEnv *env, *res_ptr = LDKRouter_init(env, clz, o); return (uint64_t)res_ptr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int64_tArray first_hops, int64_t scorer) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payer, int64_t params, int8_tArray payment_hash, int64_tArray first_hops, int64_t scorer) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; @@ -10986,6 +11513,10 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv params_conv.inner = (void*)(params & (~1)); params_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + unsigned char payment_hash_arr[32]; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_arr); + unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; LDKCVec_ChannelDetailsZ first_hops_constr; LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; if (first_hops != NULL) { @@ -11010,7 +11541,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Router_1find_1route(JNIEnv if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } @@ -11419,6 +11950,21 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommit return (uint64_t)ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_some()); + return ret_conv; +} + +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCOption_NoneZ_to_java(env, COption_NoneZ_none()); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free(JNIEnv *env, jclass clz, jclass _res) { + LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_java(env, _res); + COption_NoneZ_free(_res_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CounterpartyChannelTransactionParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { LDKCounterpartyChannelTransactionParameters o_conv; o_conv.inner = (void*)(o & (~1)); @@ -13054,78 +13600,115 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free( CVec_MessageSendEventZ_free(_res_constr); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInitFeatures o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKScoringParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InitFeatures_clone(&o_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScoringParameters + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InitFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScoringParametersDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKNodeFeatures o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKScorer o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = NodeFeatures_clone(&o_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScorer + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScorerDecodeErrorZ_free(_res_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKInitFeatures o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = InitFeatures_clone(&o_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_InitFeaturesDecodeErrorZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { @@ -13165,115 +13748,115 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecode CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKInvoiceFeatures o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKNodeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InvoiceFeatures_clone(&o_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); + o_conv = NodeFeatures_clone(&o_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); + CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKScoringParameters o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKInvoiceFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); + o_conv = InvoiceFeatures_clone(&o_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); + LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScoringParametersDecodeErrorZ_free(_res_conv); + CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKScorer o_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKChannelTypeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScorer - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); + o_conv = ChannelTypeFeatures_clone(&o_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScorerDecodeErrorZ_free(_res_conv); + CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv); } JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DelayedPaymentOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { @@ -14505,6 +15088,156 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSec C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err(JNIEnv *env, jclass clz) { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_err(); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1); + jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentSecretNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK((*env)->GetArrayLength(env, o) == 32); @@ -14557,6 +15290,58 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIEr return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok(JNIEnv *env, jclass clz, int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK((*env)->GetArrayLength(env, o) == 32); + (*env)->GetByteArrayRegion(env, o, 0, 32, o_ref.data); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { + LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentPreimageAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) { LDKCVec_ChannelMonitorZ _res_constr; _res_constr.datalen = (*env)->GetArrayLength(env, _res); @@ -15706,56 +16491,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeEr return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv *env, jclass clz) { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok(); - return (uint64_t)ret_conv; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) { - LDKMonitorUpdateError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = MonitorUpdateError_clone(&e_conv); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv); - return (uint64_t)ret_conv; -} - -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1is_1ok(JNIEnv *env, jclass clz, int64_t o) { - LDKCResult_NoneMonitorUpdateErrorZ* o_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(o & ~1); - jboolean ret_val = CResult_NoneMonitorUpdateErrorZ_is_ok(o_conv); - return ret_val; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_NoneMonitorUpdateErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(arg); - return (uint64_t)ret_conv; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ* arg_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - int64_t ret_val = CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv); - return (uint64_t)ret_conv; -} - static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) { LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ"); *ret_conv = C2Tuple_OutPointScriptZ_clone(arg); @@ -19194,7 +19929,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone(JNIEn return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment(JNIEnv *env, jclass clz, int8_tArray payment_preimage, int8_tArray payment_secret) { LDKThirtyTwoBytes payment_preimage_ref; CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); @@ -19202,7 +19937,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1pa CHECK((*env)->GetArrayLength(env, payment_secret) == 32); (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose"); - *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id); + *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -19275,6 +20010,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1 return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out(JNIEnv *env, jclass clz) { + LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); + *ret_copy = ClosureReason_funding_timed_out(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) { LDKStr err_conv = java_to_owned_str(env, err); LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); @@ -19436,6 +20178,19 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1faile return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1pending_1htlcs_1forwardable(JNIEnv *env, jclass clz, int64_t time_forwardable) { LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); *ret_copy = Event_pending_htlcs_forwardable(time_forwardable); @@ -19506,6 +20261,36 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding(JNI return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful(JNIEnv *env, jclass clz, int8_tArray payment_id, int8_tArray payment_hash, int64_tArray path) { + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = (*env)->GetArrayLength(env, path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL); + for (size_t k = 0; k < path_constr.datalen; k++) { + int64_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (*env)->ReleaseLongArrayElements(env, path, path_vals, 0); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -19985,6 +20770,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1clone(JNIEnv *env, jc return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1gossip(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKLevel_to_java(env, Level_gossip()); + return ret_conv; +} + JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1trace(JNIEnv *env, jclass clz) { jclass ret_conv = LDKLevel_to_java(env, Level_trace()); return ret_conv; @@ -20837,7 +21627,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwa UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) { +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels(JNIEnv *env, jclass clz, int64_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UserConfig_set_accept_inbound_channels(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env, jclass clz, int64_t own_channel_config_arg, int64_t peer_channel_config_limits_arg, int64_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) { LDKChannelHandshakeConfig own_channel_config_arg_conv; own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1)); own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0); @@ -20853,7 +21660,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_UserConfig_1new(JNIEnv *env channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); - LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg); + LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -21656,86 +22463,6 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read( return (uint64_t)ret_conv; } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKMonitorUpdateError this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - MonitorUpdateError_free(this_obj_conv); -} - -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1get_1a(JNIEnv *env, jclass clz, int64_t this_ptr) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv); - jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len); - Str_free(ret_str); - return ret_conv; -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1set_1a(JNIEnv *env, jclass clz, int64_t this_ptr, jstring val) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr val_conv = java_to_owned_str(env, val); - MonitorUpdateError_set_a(&this_ptr_conv, val_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1new(JNIEnv *env, jclass clz, jstring a_arg) { - LDKStr a_arg_conv = java_to_owned_str(env, a_arg); - LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg) { - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(arg); -uint64_t ret_ref = 0; -CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. -CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. -CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); -ret_ref = (uint64_t)ret_var.inner; -if (ret_var.is_owned) { - ret_ref |= 1; -} - return ret_ref; -} -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { - LDKMonitorUpdateError arg_conv; - arg_conv.inner = (void*)(arg & (~1)); - arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - int64_t ret_val = MonitorUpdateError_clone_ptr(&arg_conv); - return ret_val; -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone(JNIEnv *env, jclass clz, int64_t orig) { - LDKMonitorUpdateError orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); @@ -22040,7 +22767,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1mon void* logger_ptr = (void*)(((uint64_t)logger) & ~1); if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv); return (uint64_t)ret_conv; } @@ -23443,6 +24170,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channe return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1sign_1counterparty_1payment_1input(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray spend_tx, int64_t input_idx, int64_t descriptor) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -24199,6 +24935,23 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1cha ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ChannelDetails_set_balance_msat(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -24347,7 +25100,7 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi ChannelDetails_set_is_public(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv *env, jclass clz, int8_tArray channel_id_arg, int64_t counterparty_arg, int64_t funding_txo_arg, int64_t short_channel_id_arg, int64_t channel_value_satoshis_arg, int64_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, int64_t confirmations_required_arg, int64_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK((*env)->GetArrayLength(env, channel_id_arg) == 32); (*env)->GetByteArrayRegion(env, channel_id_arg, 0, 32, channel_id_arg_ref.data); @@ -24376,7 +25129,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new(JNIEnv CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1)); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -24774,6 +25527,17 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1paym return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK((*env)->GetArrayLength(env, payment_id) == 32); + (*env)->GetByteArrayRegion(env, payment_id, 0, 32, payment_id_ref.data); + ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1spontaneous_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -24890,7 +25654,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1ou return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -24899,12 +25663,43 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); - LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); - return ((uint64_t)ret_conv); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int64_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -24917,7 +25712,23 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inb LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); + *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK((*env)->GetArrayLength(env, payment_hash) == 32); + (*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data); + LDKThirtyTwoBytes payment_secret_ref; + CHECK((*env)->GetArrayLength(env, payment_secret) == 32); + (*env)->GetByteArrayRegion(env, payment_secret, 0, 32, payment_secret_ref.data); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } @@ -26023,6 +26834,38 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1fla OpenChannel_set_channel_flags(&this_ptr_conv, val); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv); + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + OpenChannel_set_channel_type(&this_ptr_conv, val_conv); +} + static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) { LDKOpenChannel ret_var = OpenChannel_clone(arg); uint64_t ret_ref = 0; @@ -28324,12 +29167,12 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6(JNIEnv *en return ret_ref; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray addr, int16_t port) { - LDKTenBytes addr_ref; - CHECK((*env)->GetArrayLength(env, addr) == 10); - (*env)->GetByteArrayRegion(env, addr, 0, 10, addr_ref.data); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2(JNIEnv *env, jclass clz, int8_tArray a) { + LDKTwelveBytes a_ref; + CHECK((*env)->GetArrayLength(env, a) == 12); + (*env)->GetByteArrayRegion(env, a, 0, 12, a_ref.data); LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); - *ret_copy = NetAddress_onion_v2(addr_ref, port); + *ret_copy = NetAddress_onion_v2(a_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -30024,6 +30867,13 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1l return ret_ref; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip(JNIEnv *env, jclass clz) { + LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction"); + *ret_copy = ErrorAction_ignore_duplicate_gossip(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErrorAction_1send_1error_1message(JNIEnv *env, jclass clz, int64_t msg) { LDKErrorMessage msg_conv; msg_conv.inner = (void*)(msg & (~1)); @@ -31759,6 +32609,16 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occu PeerManager_timer_tick_occurred(&this_arg_conv); } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) { + int64_t ret_val = htlc_success_tx_weight(opt_anchors); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight(JNIEnv *env, jclass clz, jboolean opt_anchors) { + int64_t ret_val = htlc_timeout_tx_weight(opt_anchors); + return ret_val; +} + JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv *env, jclass clz, int8_tArray commitment_seed, int64_t idx) { unsigned char commitment_seed_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_seed) == 32); @@ -32478,7 +33338,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1rea return (uint64_t)ret_conv; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, int64_t keys) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv *env, jclass clz, int64_t htlc, jboolean opt_anchors, int64_t keys) { LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = false; @@ -32487,7 +33347,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv); - LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); + LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); CVec_u8Z_free(ret_var); @@ -32508,7 +33368,7 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemsc return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv *env, jclass clz, int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, int64_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { unsigned char commitment_txid_arr[32]; CHECK((*env)->GetArrayLength(env, commitment_txid) == 32); (*env)->GetByteArrayRegion(env, commitment_txid, 0, 32, commitment_txid_arr); @@ -32523,13 +33383,24 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transactio LDKPublicKey revocation_key_ref; CHECK((*env)->GetArrayLength(env, revocation_key) == 33); (*env)->GetByteArrayRegion(env, revocation_key, 0, 33, revocation_key_ref.compressed_form); - LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); + LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); Transaction_free(ret_var); return ret_arr; } +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript(JNIEnv *env, jclass clz, int8_tArray funding_pubkey) { + LDKPublicKey funding_pubkey_ref; + CHECK((*env)->GetArrayLength(env, funding_pubkey) == 33); + (*env)->GetByteArrayRegion(env, funding_pubkey, 0, 33, funding_pubkey_ref.compressed_form); + LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKChannelTransactionParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -32666,7 +33537,25 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1 ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg) { +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jclass ret_conv = LDKCOption_NoneZ_to_java(env, ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv)); + return ret_conv; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_ptr, jclass val) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_java(env, val); + ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new(JNIEnv *env, jclass clz, int64_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, int64_t counterparty_parameters_arg, int64_t funding_outpoint_arg, jclass opt_anchors_arg) { LDKChannelPublicKeys holder_pubkeys_arg_conv; holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1)); holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0); @@ -32682,7 +33571,8 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameter funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv); funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv); - LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv); + LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_java(env, opt_anchors_arg); + LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -33007,6 +33897,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionP return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKDirectedChannelTransactionParameters this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv); + return ret_val; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKHolderCommitmentTransaction this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -33724,6 +34623,15 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransactio return ret_ref; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKTrustedCommitmentTransaction this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv); + return ret_val; +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray htlc_base_key, int64_t channel_parameters) { LDKTrustedCommitmentTransaction this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -33805,6 +34713,19 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq(JNIEnv return ret_val; } +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { + LDKChannelTypeFeatures a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + LDKChannelTypeFeatures b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv); + return ret_val; +} + static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) { LDKInitFeatures ret_var = InitFeatures_clone(arg); uint64_t ret_ref = 0; @@ -33957,6 +34878,44 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone(JNIE return ret_ref; } +static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); +uint64_t ret_ref = 0; +CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uint64_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr(JNIEnv *env, jclass clz, int64_t arg) { + LDKChannelTypeFeatures arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv); + return ret_val; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone(JNIEnv *env, jclass clz, int64_t orig) { + LDKChannelTypeFeatures orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKInitFeatures this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -33989,6 +34948,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free(JNIEnv * InvoiceFeatures_free(this_obj_conv); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKChannelTypeFeatures this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ChannelTypeFeatures_free(this_obj_conv); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1empty(JNIEnv *env, jclass clz) { LDKInitFeatures ret_var = InitFeatures_empty(); uint64_t ret_ref = 0; @@ -34129,30 +35096,38 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_ return ret_val; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInitFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty(JNIEnv *env, jclass clz) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKNodeFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known(JNIEnv *env, jclass clz) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) { - LDKInvoiceFeatures this_arg_conv; +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv); + jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv); return ret_val; } @@ -34168,16 +35143,14 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write(JNI return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKNodeFeatures obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = InitFeatures_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; } JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { @@ -34192,28 +35165,28 @@ JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write( return ret_arr; } -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKInvoiceFeatures obj_conv; +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = (*env)->GetArrayLength(env, ser); + ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); + LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); + *ret_conv = ChannelFeatures_read(ser_ref); + (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); + return (uint64_t)ret_conv; +} + +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKNodeFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); CVec_u8Z_free(ret_var); return ret_arr; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = (*env)->GetArrayLength(env, ser); - ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = InitFeatures_read(ser_ref); - (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); - return (uint64_t)ret_conv; -} - JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); @@ -34224,22 +35197,46 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read(JNIEnv * return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKInvoiceFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); - *ret_conv = ChannelFeatures_read(ser_ref); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = InvoiceFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { +JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write(JNIEnv *env, jclass clz, int64_t obj) { + LDKChannelTypeFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv); + int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); + (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read(JNIEnv *env, jclass clz, int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = (*env)->GetArrayLength(env, ser); ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = InvoiceFeatures_read(ser_ref); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0); return (uint64_t)ret_conv; } @@ -34518,55 +35515,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass Type_free(this_ptr_conv); } -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { - if ((this_ptr & 1) != 0) return; - void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); - CHECK_ACCESS(this_ptr_ptr); - LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); - FREE((void*)this_ptr); - Score_free(this_ptr_conv); -} - -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) { - LDKLockableScore this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - LockableScore_free(this_obj_conv); -} - -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockableScore_1new(JNIEnv *env, jclass clz, int64_t score) { - void* score_ptr = (void*)(((uint64_t)score) & ~1); - CHECK_ACCESS(score_ptr); - LDKScore score_conv = *(LDKScore*)(score_ptr); - if (score_conv.free == LDKScore_JCalls_free) { - // If this_arg is a JCalls struct, then we need to increment the refcnt in it. - LDKScore_JCalls_cloned(&score_conv); - } - LDKLockableScore ret_var = LockableScore_new(score_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LockableScore_1write(JNIEnv *env, jclass clz, int64_t obj) { - LDKLockableScore obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv); - int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen); - (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data); - CVec_u8Z_free(ret_var); - return ret_arr; -} - JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeId_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -35359,53 +36307,6 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new(JNIEnv *env, jclass clz, int64_t features_arg, int64_t node_one_arg, int64_t one_to_two_arg, int64_t node_two_arg, int64_t two_to_one_arg, int64_t capacity_sats_arg, int64_t announcement_message_arg) { - LDKChannelFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv); - features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKNodeId node_one_arg_conv; - node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); - node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_one_arg_conv); - node_one_arg_conv = NodeId_clone(&node_one_arg_conv); - LDKDirectionalChannelInfo one_to_two_arg_conv; - one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); - one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(one_to_two_arg_conv); - one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKNodeId node_two_arg_conv; - node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); - node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_two_arg_conv); - node_two_arg_conv = NodeId_clone(&node_two_arg_conv); - LDKDirectionalChannelInfo two_to_one_arg_conv; - two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); - two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(two_to_one_arg_conv); - two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); - void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1); - CHECK_ACCESS(capacity_sats_arg_ptr); - LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr); - capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); - LDKChannelAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv); - announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) { LDKChannelInfo ret_var = ChannelInfo_clone(arg); uint64_t ret_ref = 0; @@ -36199,6 +37100,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEn NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time(JNIEnv *env, jclass clz, int64_t this_arg, int64_t current_time_unix) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -37654,6 +38563,52 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_find_1route(JNIEnv *env, jc return (uint64_t)ret_conv; } +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free(JNIEnv *env, jclass clz, int64_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + LockableScore_free(this_ptr_conv); +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free(JNIEnv *env, jclass clz, int64_t this_obj) { + LDKMultiThreadedLockableScore this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + MultiThreadedLockableScore_free(this_obj_conv); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new(JNIEnv *env, jclass clz, int64_t score) { + void* score_ptr = (void*)(((uint64_t)score) & ~1); + CHECK_ACCESS(score_ptr); + LDKScore score_conv = *(LDKScore*)(score_ptr); + if (score_conv.free == LDKScore_JCalls_free) { + // If this_arg is a JCalls struct, then we need to increment the refcnt in it. + LDKScore_JCalls_cloned(&score_conv); + } + LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Scorer_1free(JNIEnv *env, jclass clz, int64_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -37704,6 +38659,40 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failur ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val); } +JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1start_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val); +} + +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv); + return ret_val; +} + +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1msat_1per_11024th(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val); +} + JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failure_1penalty_1half_1life(JNIEnv *env, jclass clz, int64_t this_ptr) { LDKScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -37721,8 +38710,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failur ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val); } -JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) { - LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new(JNIEnv *env, jclass clz, int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) { + LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -39655,6 +40644,11 @@ JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_ return ret_conv; } +JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount(JNIEnv *env, jclass clz) { + jclass ret_conv = LDKCreationError_to_java(env, CreationError_invalid_amount()); + return ret_conv; +} + JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CreationError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) { LDKCreationError* a_conv = (LDKCreationError*)(a & ~1); LDKCreationError* b_conv = (LDKCreationError*)(b & ~1); @@ -39999,7 +40993,7 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1new(JNIEnv *e // If this_arg is a JCalls struct, then we need to increment the refcnt in it. LDKRouter_JCalls_cloned(&router_conv); } - LDKLockableScore scorer_conv; + LDKMultiThreadedLockableScore scorer_conv; scorer_conv.inner = (void*)(scorer & (~1)); scorer_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv); @@ -40062,6 +41056,22 @@ JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1va return (uint64_t)ret_conv; } +JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKPublicKey pubkey_ref; + CHECK((*env)->GetArrayLength(env, pubkey) == 33); + (*env)->GetByteArrayRegion(env, pubkey, 0, 33, pubkey_ref.compressed_form); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK((*env)->GetArrayLength(env, payment_preimage) == 32); + (*env)->GetByteArrayRegion(env, payment_preimage, 0, 32, payment_preimage_ref.data); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); + return (uint64_t)ret_conv; +} + JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1remove_1cached_1payment(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray payment_hash) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); diff --git a/src/main/jni/org_ldk_enums_COption_NoneZ.h b/src/main/jni/org_ldk_enums_COption_NoneZ.h new file mode 100644 index 00000000..b37e0eac --- /dev/null +++ b/src/main/jni/org_ldk_enums_COption_NoneZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_enums_COption_NoneZ */ + +#ifndef _Included_org_ldk_enums_COption_NoneZ +#define _Included_org_ldk_enums_COption_NoneZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_enums_COption_NoneZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_enums_COption_1NoneZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings.h b/src/main/jni/org_ldk_impl_bindings.h index 450eae03..4fb1b598 100644 --- a/src/main/jni/org_ldk_impl_bindings.h +++ b/src/main/jni/org_ldk_impl_bindings.h @@ -729,34 +729,50 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1f /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InitFeaturesDecodeErrorZ_get_ok + * Method: LDKCResult_ScoringParametersDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InitFeaturesDecodeErrorZ_get_err + * Method: LDKCResult_ScoringParametersDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_NodeFeaturesDecodeErrorZ_get_ok + * Method: LDKCResult_ScorerDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_NodeFeaturesDecodeErrorZ_get_err + * Method: LDKCResult_ScorerDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_InitFeaturesDecodeErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_InitFeaturesDecodeErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InitFeaturesDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -777,50 +793,50 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelFeaturesDe /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok + * Method: LDKCResult_NodeFeaturesDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err + * Method: LDKCResult_NodeFeaturesDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NodeFeaturesDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ScoringParametersDecodeErrorZ_get_ok + * Method: LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ScoringParametersDecodeErrorZ_get_err + * Method: LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScoringParametersDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceFeaturesDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ScorerDecodeErrorZ_get_ok + * Method: LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: LDKCResult_ScorerDecodeErrorZ_get_err + * Method: LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ScorerDecodeErrorZ_1get_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1ChannelTypeFeaturesDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); /* @@ -1335,6 +1351,54 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaym JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1get_1b (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentSecretNoneZ_get_ok + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentSecretNoneZ_get_err + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretNoneZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKCResult_PaymentSecretAPIErrorZ_get_ok @@ -1351,6 +1415,22 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecre JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentSecretAPIErrorZ_1get_1err (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentPreimageAPIErrorZ_get_ok + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LDKCResult_PaymentPreimageAPIErrorZ_get_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PaymentPreimageAPIErrorZ_1get_1err + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKWatch_new @@ -1463,6 +1543,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1read_1chan_1si JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1sign_1invoice (JNIEnv *, jclass, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: KeysInterface_get_inbound_payment_key_material + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1inbound_1payment_1key_1material + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKFeeEstimator_new @@ -1887,22 +1975,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeE JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1HTLCUpdateDecodeErrorZ_1get_1err (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: LDKCResult_NoneMonitorUpdateErrorZ_get_ok - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LDKCResult_NoneMonitorUpdateErrorZ_get_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: C2Tuple_OutPointScriptZ_get_a @@ -3386,10 +3458,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKScore_1new /* * Class: org_ldk_impl_bindings * Method: Score_channel_penalty_msat - * Signature: (JJJJ)J + * Signature: (JJJJJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat - (JNIEnv *, jclass, jlong, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -3399,6 +3471,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Score_1channel_1penalty_1msat JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed (JNIEnv *, jclass, jlong, jlongArray, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Score_payment_path_successful + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1successful + (JNIEnv *, jclass, jlong, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: Score_write @@ -3407,6 +3487,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1payment_1path_1failed JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Score_1write (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: LDKLockableScore_new + * Signature: (Lorg/ldk/impl/bindings/LDKLockableScore;)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKLockableScore_1new + (JNIEnv *, jclass, jobject); + +/* + * Class: org_ldk_impl_bindings + * Method: LockableScore_lock + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockableScore_1lock + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: LDKChannelManagerPersister_new @@ -3463,6 +3559,14 @@ JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Payer_1first_1hops JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: Payer_send_spontaneous_payment + * Signature: (JJ[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1send_1spontaneous_1payment + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: Payer_retry_payment @@ -3471,6 +3575,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1send_1payment JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Payer_1retry_1payment (JNIEnv *, jclass, jlong, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: Payer_abandon_payment + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Payer_1abandon_1payment + (JNIEnv *, jclass, jlong, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: LDKRouter_new @@ -3482,10 +3594,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKRouter_1new /* * Class: org_ldk_impl_bindings * Method: Router_find_route - * Signature: (J[BJ[JJ)J + * Signature: (J[BJ[B[JJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Router_1find_1route - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jlongArray, jlong); + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jbyteArray, jlongArray, jlong); /* * Class: org_ldk_impl_bindings @@ -3863,6 +3975,30 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitme JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCOutputInCommitmentDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: COption_NoneZ_some + * Signature: ()Lorg/ldk/enums/COption_NoneZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1some + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NoneZ_none + * Signature: ()Lorg/ldk/enums/COption_NoneZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1none + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: COption_NoneZ_free + * Signature: (Lorg/ldk/enums/COption_NoneZ;)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NoneZ_1free + (JNIEnv *, jclass, jobject); + /* * Class: org_ldk_impl_bindings * Method: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok @@ -5209,66 +5345,98 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free /* * Class: org_ldk_impl_bindings - * Method: CResult_InitFeaturesDecodeErrorZ_ok + * Method: CResult_ScoringParametersDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InitFeaturesDecodeErrorZ_err + * Method: CResult_ScoringParametersDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InitFeaturesDecodeErrorZ_is_ok + * Method: CResult_ScoringParametersDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InitFeaturesDecodeErrorZ_free + * Method: CResult_ScoringParametersDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NodeFeaturesDecodeErrorZ_ok + * Method: CResult_ScorerDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NodeFeaturesDecodeErrorZ_err + * Method: CResult_ScorerDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NodeFeaturesDecodeErrorZ_is_ok + * Method: CResult_ScorerDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NodeFeaturesDecodeErrorZ_free + * Method: CResult_ScorerDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_InitFeaturesDecodeErrorZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_InitFeaturesDecodeErrorZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_InitFeaturesDecodeErrorZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_InitFeaturesDecodeErrorZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InitFeaturesDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* @@ -5305,98 +5473,98 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelFeaturesDecode /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceFeaturesDecodeErrorZ_ok + * Method: CResult_NodeFeaturesDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceFeaturesDecodeErrorZ_err + * Method: CResult_NodeFeaturesDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceFeaturesDecodeErrorZ_is_ok + * Method: CResult_NodeFeaturesDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_InvoiceFeaturesDecodeErrorZ_free + * Method: CResult_NodeFeaturesDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NodeFeaturesDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScoringParametersDecodeErrorZ_ok + * Method: CResult_InvoiceFeaturesDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScoringParametersDecodeErrorZ_err + * Method: CResult_InvoiceFeaturesDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScoringParametersDecodeErrorZ_is_ok + * Method: CResult_InvoiceFeaturesDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScoringParametersDecodeErrorZ_free + * Method: CResult_InvoiceFeaturesDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScoringParametersDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceFeaturesDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScorerDecodeErrorZ_ok + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScorerDecodeErrorZ_err + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScorerDecodeErrorZ_is_ok + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_ScorerDecodeErrorZ_free + * Method: CResult_ChannelTypeFeaturesDecodeErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ScorerDecodeErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1ChannelTypeFeaturesDecodeErrorZ_1free (JNIEnv *, jclass, jlong); /* @@ -6281,210 +6449,402 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailu /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_err - * Signature: (J)J + * Method: CResult_NonePaymentSendFailureZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NonePaymentSendFailureZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NonePaymentSendFailureZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NonePaymentSendFailureZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_NonePaymentSendFailureZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_new + * Signature: ([B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new + (JNIEnv *, jclass, jbyteArray, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentIdZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CVec_NetAddressZ_free + * Signature: ([J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free + (JNIEnv *, jclass, jlongArray); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentSecretZ_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentSecretZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentSecretZ_new + * Signature: ([B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new + (JNIEnv *, jclass, jbyteArray, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: C2Tuple_PaymentHashPaymentSecretZ_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1ok + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err + * Signature: ()J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1err + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_is_ok + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_free + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_clone_ptr + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_NonePaymentSendFailureZ_clone + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZNoneZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentIdZ_clone_ptr + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentIdZ_clone + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentIdZ_new - * Signature: ([B[B)J + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok + * Signature: (J)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1new - (JNIEnv *, jclass, jbyteArray, jbyteArray); +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1is_1ok + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentIdZ_free + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentIdZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err + * Method: CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentSecretZAPIErrorZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok + * Method: CResult_PaymentSecretNoneZ_ok + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1ok + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentSecretNoneZ_err + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1err + (JNIEnv *, jclass); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentSecretNoneZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free + * Method: CResult_PaymentSecretNoneZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone_ptr + * Method: CResult_PaymentSecretNoneZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone + * Method: CResult_PaymentSecretNoneZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1PaymentHashPaymentIdZPaymentSendFailureZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretNoneZ_1clone (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CVec_NetAddressZ_free - * Signature: ([J)V + * Method: CResult_PaymentSecretAPIErrorZ_ok + * Signature: ([B)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free - (JNIEnv *, jclass, jlongArray); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentSecretZ_clone_ptr + * Method: CResult_PaymentSecretAPIErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentSecretZ_clone - * Signature: (J)J + * Method: CResult_PaymentSecretAPIErrorZ_is_ok + * Signature: (J)Z */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1clone +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentSecretZ_new - * Signature: ([B[B)J + * Method: CResult_PaymentSecretAPIErrorZ_free + * Signature: (J)V */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1new - (JNIEnv *, jclass, jbyteArray, jbyteArray); +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: C2Tuple_PaymentHashPaymentSecretZ_free - * Signature: (J)V + * Method: CResult_PaymentSecretAPIErrorZ_clone_ptr + * Signature: (J)J */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PaymentHashPaymentSecretZ_1free +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentSecretAPIErrorZ_ok + * Method: CResult_PaymentSecretAPIErrorZ_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: CResult_PaymentPreimageAPIErrorZ_ok * Signature: ([B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1ok +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1ok (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentSecretAPIErrorZ_err + * Method: CResult_PaymentPreimageAPIErrorZ_err * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1err (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentSecretAPIErrorZ_is_ok + * Method: CResult_PaymentPreimageAPIErrorZ_is_ok * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1is_1ok +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1is_1ok (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentSecretAPIErrorZ_free + * Method: CResult_PaymentPreimageAPIErrorZ_free * Signature: (J)V */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1free +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1free (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentSecretAPIErrorZ_clone_ptr + * Method: CResult_PaymentPreimageAPIErrorZ_clone_ptr * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone_1ptr +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone_1ptr (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings - * Method: CResult_PaymentSecretAPIErrorZ_clone + * Method: CResult_PaymentPreimageAPIErrorZ_clone * Signature: (J)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1clone +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentPreimageAPIErrorZ_1clone (JNIEnv *, jclass, jlong); /* @@ -7511,54 +7871,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErro JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1HTLCUpdateDecodeErrorZ_1clone (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneMonitorUpdateErrorZ_ok - * Signature: ()J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok - (JNIEnv *, jclass); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneMonitorUpdateErrorZ_err - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneMonitorUpdateErrorZ_is_ok - * Signature: (J)Z - */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1is_1ok - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneMonitorUpdateErrorZ_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneMonitorUpdateErrorZ_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: CResult_NoneMonitorUpdateErrorZ_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1clone - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: C2Tuple_OutPointScriptZ_clone_ptr @@ -10370,10 +10682,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1clone /* * Class: org_ldk_impl_bindings * Method: PaymentPurpose_invoice_payment - * Signature: ([B[BJ)J + * Signature: ([B[B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1invoice_1payment - (JNIEnv *, jclass, jbyteArray, jbyteArray, jlong); + (JNIEnv *, jclass, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -10439,6 +10751,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1c JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: ClosureReason_funding_timed_out + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1funding_1timed_1out + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: ClosureReason_processing_error @@ -10535,6 +10855,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1sent JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed (JNIEnv *, jclass, jbyteArray, jbyteArray, jboolean, jlong, jboolean, jlongArray, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Event_payment_failed + * Signature: ([B[B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed + (JNIEnv *, jclass, jbyteArray, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: Event_pending_htlcs_forwardable @@ -10575,6 +10903,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1discard_1funding (JNIEnv *, jclass, jbyteArray, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: Event_payment_path_successful + * Signature: ([B[B[J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1successful + (JNIEnv *, jclass, jbyteArray, jbyteArray, jlongArray); + /* * Class: org_ldk_impl_bindings * Method: Event_write @@ -10895,6 +11231,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_verify JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Level_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Level_gossip + * Signature: ()Lorg/ldk/enums/Level; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Level_1gossip + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: Level_trace @@ -11567,13 +11911,29 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1f JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1forwards_1to_1priv_1channels (JNIEnv *, jclass, jlong, jboolean); +/* + * Class: org_ldk_impl_bindings + * Method: UserConfig_get_accept_inbound_channels + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1accept_1inbound_1channels + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: UserConfig_set_accept_inbound_channels + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1accept_1inbound_1channels + (JNIEnv *, jclass, jlong, jboolean); + /* * Class: org_ldk_impl_bindings * Method: UserConfig_new - * Signature: (JJJZ)J + * Signature: (JJJZZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jboolean); + (JNIEnv *, jclass, jlong, jlong, jlong, jboolean, jboolean); /* * Class: org_ldk_impl_bindings @@ -12079,54 +12439,6 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1wr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read (JNIEnv *, jclass, jbyteArray); -/* - * Class: org_ldk_impl_bindings - * Method: MonitorUpdateError_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: MonitorUpdateError_get_a - * Signature: (J)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1get_1a - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: MonitorUpdateError_set_a - * Signature: (JLjava/lang/String;)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1set_1a - (JNIEnv *, jclass, jlong, jstring); - -/* - * Class: org_ldk_impl_bindings - * Method: MonitorUpdateError_new - * Signature: (Ljava/lang/String;)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1new - (JNIEnv *, jclass, jstring); - -/* - * Class: org_ldk_impl_bindings - * Method: MonitorUpdateError_clone_ptr - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone_1ptr - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: MonitorUpdateError_clone - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1clone - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: MonitorEvent_free @@ -13111,6 +13423,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1funding_1outp JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1get_1channel_1parameters (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: InMemorySigner_opt_anchors + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1opt_1anchors + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: InMemorySigner_sign_counterparty_payment_input @@ -13567,6 +13887,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1ch JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1channel_1id (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_get_balance_msat + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1balance_1msat + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelDetails_set_balance_msat + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1balance_1msat + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ChannelDetails_get_outbound_capacity_msat @@ -13698,10 +14034,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1publi /* * Class: org_ldk_impl_bindings * Method: ChannelDetails_new - * Signature: ([BJJJJJJJJJJZZZZ)J + * Signature: ([BJJJJJJJJJJJZZZZ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1new - (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jboolean, jboolean, jboolean, jboolean); + (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jlong, jboolean, jboolean, jboolean, jboolean); /* * Class: org_ldk_impl_bindings @@ -13863,6 +14199,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1retry_1payment (JNIEnv *, jclass, jlong, jlong, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_abandon_payment + * Signature: (J[B)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1abandon_1payment + (JNIEnv *, jclass, jlong, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: ChannelManager_send_spontaneous_payment @@ -13921,27 +14265,51 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1fun /* * Class: org_ldk_impl_bindings - * Method: ChannelManager_get_our_node_id - * Signature: (J)[B + * Method: ChannelManager_get_our_node_id + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_create_inbound_payment + * Signature: (JJI)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_create_inbound_payment_legacy + * Signature: (JJI)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1legacy + (JNIEnv *, jclass, jlong, jlong, jint); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelManager_create_inbound_payment_for_hash + * Signature: (J[BJI)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: ChannelManager_create_inbound_payment - * Signature: (JJIJ)J + * Method: ChannelManager_create_inbound_payment_for_hash_legacy + * Signature: (J[BJI)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment - (JNIEnv *, jclass, jlong, jlong, jint, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash_1legacy + (JNIEnv *, jclass, jlong, jbyteArray, jlong, jint); /* * Class: org_ldk_impl_bindings - * Method: ChannelManager_create_inbound_payment_for_hash - * Signature: (J[BJIJ)J + * Method: ChannelManager_get_payment_preimage + * Signature: (J[B[B)J */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1inbound_1payment_1for_1hash - (JNIEnv *, jclass, jlong, jbyteArray, jlong, jint, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1payment_1preimage + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -14679,6 +15047,22 @@ JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1fl JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags (JNIEnv *, jclass, jlong, jbyte); +/* + * Class: org_ldk_impl_bindings + * Method: OpenChannel_get_channel_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1type + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: OpenChannel_set_channel_type + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1type + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: OpenChannel_clone_ptr @@ -16194,10 +16578,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1ipv6 /* * Class: org_ldk_impl_bindings * Method: NetAddress_onion_v2 - * Signature: ([BS)J + * Signature: ([B)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetAddress_1onion_1v2 - (JNIEnv *, jclass, jbyteArray, jshort); + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -17295,6 +17679,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1error JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1and_1log (JNIEnv *, jclass, jobject); +/* + * Class: org_ldk_impl_bindings + * Method: ErrorAction_ignore_duplicate_gossip + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorAction_1ignore_1duplicate_1gossip + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: ErrorAction_send_error_message @@ -18335,6 +18727,22 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1disconnect_1all_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occurred (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: htlc_success_tx_weight + * Signature: (Z)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_htlc_1success_1tx_1weight + (JNIEnv *, jclass, jboolean); + +/* + * Class: org_ldk_impl_bindings + * Method: htlc_timeout_tx_weight + * Signature: (Z)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_htlc_1timeout_1tx_1weight + (JNIEnv *, jclass, jboolean); + /* * Class: org_ldk_impl_bindings * Method: build_commitment_secret @@ -18794,10 +19202,10 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read /* * Class: org_ldk_impl_bindings * Method: get_htlc_redeemscript - * Signature: (JJ)[B + * Signature: (JZJ)[B */ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript - (JNIEnv *, jclass, jlong, jlong); + (JNIEnv *, jclass, jlong, jboolean, jlong); /* * Class: org_ldk_impl_bindings @@ -18810,10 +19218,18 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscr /* * Class: org_ldk_impl_bindings * Method: build_htlc_transaction - * Signature: ([BISJ[B[B)[B + * Signature: ([BISJZ[B[B)[B */ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction - (JNIEnv *, jclass, jbyteArray, jint, jshort, jlong, jbyteArray, jbyteArray); + (JNIEnv *, jclass, jbyteArray, jint, jshort, jlong, jboolean, jbyteArray, jbyteArray); + +/* + * Class: org_ldk_impl_bindings + * Method: get_anchor_redeemscript + * Signature: ([B)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1anchor_1redeemscript + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -18903,13 +19319,29 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1funding_1outpoint (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTransactionParameters_get_opt_anchors + * Signature: (J)Lorg/ldk/enums/COption_NoneZ; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1get_1opt_1anchors + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTransactionParameters_set_opt_anchors + * Signature: (JLorg/ldk/enums/COption_NoneZ;)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1set_1opt_1anchors + (JNIEnv *, jclass, jlong, jobject); + /* * Class: org_ldk_impl_bindings * Method: ChannelTransactionParameters_new - * Signature: (JSZJJ)J + * Signature: (JSZJJLorg/ldk/enums/COption_NoneZ;)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTransactionParameters_1new - (JNIEnv *, jclass, jlong, jshort, jboolean, jlong, jlong); + (JNIEnv *, jclass, jlong, jshort, jboolean, jlong, jlong, jobject); /* * Class: org_ldk_impl_bindings @@ -19095,6 +19527,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransaction JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1funding_1outpoint (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: DirectedChannelTransactionParameters_opt_anchors + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectedChannelTransactionParameters_1opt_1anchors + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: HolderCommitmentTransaction_free @@ -19503,6 +19943,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: TrustedCommitmentTransaction_opt_anchors + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1opt_1anchors + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: TrustedCommitmentTransaction_get_htlc_sigs @@ -19551,6 +19999,14 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1eq JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1eq (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_eq + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1eq + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: InitFeatures_clone_ptr @@ -19615,6 +20071,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone_1ptr JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1clone (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_clone_ptr + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone_1ptr + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_clone + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1clone + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: InitFeatures_free @@ -19647,6 +20119,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1free (JNIEnv *, jclass, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1free + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: InitFeatures_empty @@ -19745,26 +20225,26 @@ JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_ /* * Class: org_ldk_impl_bindings - * Method: InitFeatures_supports_payment_secret - * Signature: (J)Z + * Method: ChannelTypeFeatures_empty + * Signature: ()J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1empty + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: NodeFeatures_supports_payment_secret - * Signature: (J)Z + * Method: ChannelTypeFeatures_known + * Signature: ()J */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1supports_1payment_1secret - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1known + (JNIEnv *, jclass); /* * Class: org_ldk_impl_bindings - * Method: InvoiceFeatures_supports_payment_secret + * Method: ChannelTypeFeatures_requires_unknown_bits * Signature: (J)Z */ -JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1supports_1payment_1secret +JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1requires_1unknown_1bits (JNIEnv *, jclass, jlong); /* @@ -19777,11 +20257,11 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InitFeatures_1write /* * Class: org_ldk_impl_bindings - * Method: NodeFeatures_write - * Signature: (J)[B + * Method: InitFeatures_read + * Signature: ([B)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings @@ -19793,19 +20273,19 @@ JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1write /* * Class: org_ldk_impl_bindings - * Method: InvoiceFeatures_write - * Signature: (J)[B + * Method: ChannelFeatures_read + * Signature: ([B)J */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write - (JNIEnv *, jclass, jlong); +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read + (JNIEnv *, jclass, jbyteArray); /* * Class: org_ldk_impl_bindings - * Method: InitFeatures_read - * Signature: ([B)J + * Method: NodeFeatures_write + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InitFeatures_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1write + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -19817,11 +20297,11 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1read /* * Class: org_ldk_impl_bindings - * Method: ChannelFeatures_read - * Signature: ([B)J + * Method: InvoiceFeatures_write + * Signature: (J)[B */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read - (JNIEnv *, jclass, jbyteArray); +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1write + (JNIEnv *, jclass, jlong); /* * Class: org_ldk_impl_bindings @@ -19831,6 +20311,22 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1read JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1read (JNIEnv *, jclass, jbyteArray); +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_write + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1write + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ChannelTypeFeatures_read + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelTypeFeatures_1read + (JNIEnv *, jclass, jbyteArray); + /* * Class: org_ldk_impl_bindings * Method: ShutdownScript_free @@ -19999,38 +20495,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Type_1clone JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free (JNIEnv *, jclass, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: Score_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LockableScore_free - * Signature: (J)V - */ -JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LockableScore_new - * Signature: (J)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockableScore_1new - (JNIEnv *, jclass, jlong); - -/* - * Class: org_ldk_impl_bindings - * Method: LockableScore_write - * Signature: (J)[B - */ -JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LockableScore_1write - (JNIEnv *, jclass, jlong); - /* * Class: org_ldk_impl_bindings * Method: NodeId_free @@ -20519,14 +20983,6 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcemen JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message (JNIEnv *, jclass, jlong, jlong); -/* - * Class: org_ldk_impl_bindings - * Method: ChannelInfo_new - * Signature: (JJJJJJJ)J - */ -JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1new - (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong); - /* * Class: org_ldk_impl_bindings * Method: ChannelInfo_clone_ptr @@ -20959,6 +21415,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node (JNIEnv *, jclass, jlong, jbyteArray, jboolean); +/* + * Class: org_ldk_impl_bindings + * Method: NetworkGraph_remove_stale_channels_with_time + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1remove_1stale_1channels_1with_1time + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: NetworkGraph_update_channel @@ -21743,6 +22207,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1read JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_find_1route (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlongArray, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: Score_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Score_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: LockableScore_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockableScore_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: MultiThreadedLockableScore_free + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1free + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: MultiThreadedLockableScore_new + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MultiThreadedLockableScore_1new + (JNIEnv *, jclass, jlong); + /* * Class: org_ldk_impl_bindings * Method: Scorer_free @@ -21791,6 +22287,38 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1failu JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failure_1penalty_1msat (JNIEnv *, jclass, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: ScoringParameters_get_overuse_penalty_start_1024th + * Signature: (J)S + */ +JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1start_11024th + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ScoringParameters_set_overuse_penalty_start_1024th + * Signature: (JS)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1start_11024th + (JNIEnv *, jclass, jlong, jshort); + +/* + * Class: org_ldk_impl_bindings + * Method: ScoringParameters_get_overuse_penalty_msat_per_1024th + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1get_1overuse_1penalty_1msat_1per_11024th + (JNIEnv *, jclass, jlong); + +/* + * Class: org_ldk_impl_bindings + * Method: ScoringParameters_set_overuse_penalty_msat_per_1024th + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1overuse_1penalty_1msat_1per_11024th + (JNIEnv *, jclass, jlong, jlong); + /* * Class: org_ldk_impl_bindings * Method: ScoringParameters_get_failure_penalty_half_life @@ -21810,10 +22338,10 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1set_1failur /* * Class: org_ldk_impl_bindings * Method: ScoringParameters_new - * Signature: (JJJ)J + * Signature: (JJSJJ)J */ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ScoringParameters_1new - (JNIEnv *, jclass, jlong, jlong, jlong); + (JNIEnv *, jclass, jlong, jlong, jshort, jlong, jlong); /* * Class: org_ldk_impl_bindings @@ -23079,6 +23607,14 @@ JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1timestamp_1o JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1expiry_1time_1out_1of_1bounds (JNIEnv *, jclass); +/* + * Class: org_ldk_impl_bindings + * Method: CreationError_invalid_amount + * Signature: ()Lorg/ldk/enums/CreationError; + */ +JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_CreationError_1invalid_1amount + (JNIEnv *, jclass); + /* * Class: org_ldk_impl_bindings * Method: CreationError_eq @@ -23415,6 +23951,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1invoice JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1zero_1value_1invoice (JNIEnv *, jclass, jlong, jlong, jlong); +/* + * Class: org_ldk_impl_bindings + * Method: InvoicePayer_pay_pubkey + * Signature: (J[B[BJI)J + */ +JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoicePayer_1pay_1pubkey + (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong, jint); + /* * Class: org_ldk_impl_bindings * Method: InvoicePayer_remove_cached_payment diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_ClosureReasonZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_ClosureReasonZ.h new file mode 100644 index 00000000..b9f3d497 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_ClosureReasonZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_ClosureReasonZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_ClosureReasonZ +#define _Included_org_ldk_impl_bindings_LDKCOption_ClosureReasonZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_ClosureReasonZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1ClosureReasonZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_EventZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_EventZ.h new file mode 100644 index 00000000..f451074c --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_EventZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_EventZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_EventZ +#define _Included_org_ldk_impl_bindings_LDKCOption_EventZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_EventZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1EventZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/main/jni/org_ldk_impl_bindings_LDKCOption_MonitorEventZ.h b/src/main/jni/org_ldk_impl_bindings_LDKCOption_MonitorEventZ.h new file mode 100644 index 00000000..0881b5e7 --- /dev/null +++ b/src/main/jni/org_ldk_impl_bindings_LDKCOption_MonitorEventZ.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_ldk_impl_bindings_LDKCOption_MonitorEventZ */ + +#ifndef _Included_org_ldk_impl_bindings_LDKCOption_MonitorEventZ +#define _Included_org_ldk_impl_bindings_LDKCOption_MonitorEventZ +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_ldk_impl_bindings_LDKCOption_MonitorEventZ + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1MonitorEventZ_init + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/ts/bindings.c b/ts/bindings.c index a86ed720..0c274a48 100644 --- a/ts/bindings.c +++ b/ts/bindings.c @@ -85,6 +85,20 @@ static inline int32_t LDKAccessError_to_js(LDKAccessError val) { default: abort(); } } +static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) { + switch (ord) { + case 0: return LDKCOption_NoneZ_Some; + case 1: return LDKCOption_NoneZ_None; + } + abort(); +} +static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) { + switch (val) { + case LDKCOption_NoneZ_Some: return 0; + case LDKCOption_NoneZ_None: return 1; + default: abort(); + } +} static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) { switch (ord) { case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure; @@ -121,6 +135,7 @@ static inline LDKCreationError LDKCreationError_from_js(int32_t ord) { case 1: return LDKCreationError_RouteTooLong; case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_ExpiryTimeOutOfBounds; + case 4: return LDKCreationError_InvalidAmount; } abort(); } @@ -130,6 +145,7 @@ static inline int32_t LDKCreationError_to_js(LDKCreationError val) { case LDKCreationError_RouteTooLong: return 1; case LDKCreationError_TimestampOutOfBounds: return 2; case LDKCreationError_ExpiryTimeOutOfBounds: return 3; + case LDKCreationError_InvalidAmount: return 4; default: abort(); } } @@ -201,21 +217,23 @@ static inline int32_t LDKIOError_to_js(LDKIOError val) { } static inline LDKLevel LDKLevel_from_js(int32_t ord) { switch (ord) { - case 0: return LDKLevel_Trace; - case 1: return LDKLevel_Debug; - case 2: return LDKLevel_Info; - case 3: return LDKLevel_Warn; - case 4: return LDKLevel_Error; + case 0: return LDKLevel_Gossip; + case 1: return LDKLevel_Trace; + case 2: return LDKLevel_Debug; + case 3: return LDKLevel_Info; + case 4: return LDKLevel_Warn; + case 5: return LDKLevel_Error; } abort(); } static inline int32_t LDKLevel_to_js(LDKLevel val) { switch (val) { - case LDKLevel_Trace: return 0; - case LDKLevel_Debug: return 1; - case LDKLevel_Info: return 2; - case LDKLevel_Warn: return 3; - case LDKLevel_Error: return 4; + case LDKLevel_Gossip: return 0; + case LDKLevel_Trace: return 1; + case LDKLevel_Debug: return 2; + case LDKLevel_Info: return 3; + case LDKLevel_Warn: return 4; + case LDKLevel_Error: return 5; default: abort(); } } @@ -1011,6 +1029,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr case LDKClosureReason_CommitmentTxConfirmed: { return 0 /* LDKClosureReason - CommitmentTxConfirmed */; } + case LDKClosureReason_FundingTimedOut: { + return 0 /* LDKClosureReason - FundingTimedOut */; + } case LDKClosureReason_ProcessingError: { LDKStr err_str = obj->processing_error.err; jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); @@ -1140,7 +1161,7 @@ uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_pt memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32); int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32); - return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id; + return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; } case LDKPaymentPurpose_SpontaneousPayment: { int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -1208,6 +1229,13 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ } return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_id_arr; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; (void) retry_ref; } + case LDKEvent_PaymentFailed: { + int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_failed.payment_id.data, 32); + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32); + return 0 /* LDKEvent - PaymentFailed */; (void) payment_id_arr; (void) payment_hash_arr; + } case LDKEvent_PendingHTLCsForwardable: { return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable; } @@ -1241,6 +1269,27 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen); return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr; } + case LDKEvent_PaymentPathSuccessful: { + int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_successful.payment_id.data, 32); + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_successful.payment_hash.data, 32); + LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path; + uint32_tArray path_arr = NULL; + path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + + return 0 /* LDKEvent - PaymentPathSuccessful */; (void) payment_id_arr; (void) payment_hash_arr; (void) path_arr; + } default: abort(); } } @@ -1295,6 +1344,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(u uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log); return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv; } + case LDKErrorAction_IgnoreDuplicateGossip: { + return 0 /* LDKErrorAction - IgnoreDuplicateGossip */; + } case LDKErrorAction_SendErrorMessage: { LDKErrorMessage msg_var = obj->send_error_message.msg; uint64_t msg_ref = 0; @@ -1524,10 +1576,10 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInitFeatures res_var = (*val->contents.result); + LDKScoringParameters res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1535,8 +1587,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecod res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1546,10 +1598,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecod err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKNodeFeatures res_var = (*val->contents.result); + LDKScorer res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1557,8 +1609,30 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecod res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKInitFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var); + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1590,10 +1664,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDe err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInvoiceFeatures res_var = (*val->contents.result); + LDKNodeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1601,8 +1675,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDe res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1612,10 +1686,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDe err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScoringParameters res_var = (*val->contents.result); + LDKInvoiceFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1623,8 +1697,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParameters res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1634,10 +1708,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParameters err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScorer res_var = (*val->contents.result); + LDKChannelTypeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1645,8 +1719,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeError res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2701,9 +2775,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(ui return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port; } case LDKNetAddress_OnionV2: { - int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10); - return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port; + int8_tArray onion_v2_arr = init_arr(12, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(onion_v2_arr + 4), obj->onion_v2.data, 12); + return 0 /* LDKNetAddress - OnionV2 */; (void) onion_v2_arr; } case LDKNetAddress_OnionV3: { int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -2740,6 +2814,45 @@ int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymen return ret_arr; } +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretNoneZ_get_ok(uint32_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); + return res_arr; +} +void __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretNoneZ_get_err(uint32_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) { LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1); CHECK(val->result_ok); @@ -2753,6 +2866,19 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIE uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); + return res_arr; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentPreimageAPIErrorZ_get_err(uint32_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) { LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -2990,6 +3116,7 @@ typedef struct LDKKeysInterface_JCalls { uint32_t get_secure_random_bytes_meth; uint32_t read_chan_signer_meth; uint32_t sign_invoice_meth; + uint32_t get_inbound_payment_key_material_meth; } LDKKeysInterface_JCalls; static void LDKKeysInterface_JCalls_free(void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -3001,6 +3128,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { js_free(j_calls->get_secure_random_bytes_meth); js_free(j_calls->read_chan_signer_meth); js_free(j_calls->sign_invoice_meth); + js_free(j_calls->get_inbound_payment_key_material_meth); FREE(j_calls); } } @@ -3072,6 +3200,14 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v FREE((void*)ret); return ret_conv; } +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + int8_tArray ret = js_invoke_function_0(j_calls->get_inbound_payment_key_material_meth); + LDKThirtyTwoBytes ret_ref; + CHECK(*((uint32_t*)ret) == 32); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); + return ret_ref; +} static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -3090,6 +3226,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Referenc .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .sign_invoice = sign_invoice_LDKKeysInterface_jcall, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, .free = LDKKeysInterface_JCalls_free, }; return ret; @@ -3178,6 +3315,15 @@ uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(u return (uint64_t)ret_conv; } +int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32); + return ret_arr; +} + typedef struct LDKFeeEstimator_JCalls { atomic_size_t refcnt; uint32_t get_est_sat_per_1000_weight_meth; @@ -3805,22 +3951,6 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeE err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(val->result_ok); - return *val->contents.result; -} -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(!val->result_ok); - LDKMonitorUpdateError err_var = (*val->contents.err); - uint64_t err_ref = 0; - CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); - err_ref = (uint64_t)err_var.inner & ~1; - return err_ref; -} static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){ return OutPoint_clone(&tuple->a); } @@ -7338,6 +7468,7 @@ typedef struct LDKScore_JCalls { atomic_size_t refcnt; uint32_t channel_penalty_msat_meth; uint32_t payment_path_failed_meth; + uint32_t payment_path_successful_meth; uint32_t write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { @@ -7345,12 +7476,16 @@ static void LDKScore_JCalls_free(void* this_arg) { if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { js_free(j_calls->channel_penalty_msat_meth); js_free(j_calls->payment_path_failed_meth); + js_free(j_calls->payment_path_successful_meth); js_free(j_calls->write_meth); FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *channel_capacity_msat_copy = channel_capacity_msat; + uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy; LDKNodeId source_var = *source; uint64_t source_ref = 0; source_var = NodeId_clone(source); @@ -7371,7 +7506,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor if (target_var.is_owned) { target_ref |= 1; } - return js_invoke_function_3(j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref); + return js_invoke_function_5(j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref); } void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -7395,6 +7530,28 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, FREE(path_var.data); js_invoke_function_2(j_calls->payment_path_failed_meth, path_arr, short_channel_id); } +void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + LDKCVec_RouteHopZ path_var = path; + uint32_tArray path_arr = NULL; + path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + + FREE(path_var.data); + js_invoke_function_1(j_calls->payment_path_successful_meth, path_arr); +} LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->write_meth); @@ -7417,6 +7574,7 @@ static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) { .this_arg = (void*) calls, .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, .payment_path_failed = payment_path_failed_LDKScore_jcall, + .payment_path_successful = payment_path_successful_LDKScore_jcall, .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; @@ -7427,10 +7585,14 @@ long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object R *res_ptr = LDKScore_init(o); return (long)res_ptr; } -int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, uint32_t source, uint32_t target) { +int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, uint32_t channel_capacity_msat, uint32_t source, uint32_t target) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1); + CHECK_ACCESS(channel_capacity_msat_ptr); + LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr); + channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1)); LDKNodeId source_conv; source_conv.inner = (void*)(source & (~1)); source_conv.is_owned = false; @@ -7439,7 +7601,7 @@ int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(ui target_conv.inner = (void*)(target & (~1)); target_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv); return ret_val; } @@ -7466,6 +7628,29 @@ void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); } +void __attribute__((visibility("default"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = *((uint32_t*)path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + uint32_t* path_vals = (uint32_t*)(path + 4); + for (size_t k = 0; k < path_constr.datalen; k++) { + uint32_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr); +} + int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -7477,6 +7662,56 @@ int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this return ret_arr; } +typedef struct LDKLockableScore_JCalls { + atomic_size_t refcnt; + uint32_t lock_meth; +} LDKLockableScore_JCalls; +static void LDKLockableScore_JCalls_free(void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + js_free(j_calls->lock_meth); + FREE(j_calls); + } +} +LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + uint32_t ret = js_invoke_function_0(j_calls->lock_meth); + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore + + return ret_conv; +} +static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKLockableScore LDKLockableScore_init (/*TODO: JS Object Reference */void* o) { + LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls"); + atomic_init(&calls->refcnt, 1); + //TODO: Assign calls->o from o + + LDKLockableScore ret = { + .this_arg = (void*) calls, + .lock = lock_LDKLockableScore_jcall, + .free = LDKLockableScore_JCalls_free, + }; + return ret; +} +long __attribute__((visibility("default"))) TS_LDKLockableScore_new(/*TODO: JS Object Reference */void* o) { + LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore"); + *res_ptr = LDKLockableScore_init(o); + return (long)res_ptr; +} +uint32_t __attribute__((visibility("default"))) TS_LockableScore_lock(uint32_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr; + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg); + return (uint64_t)ret_ret; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; uint32_t persist_manager_meth; @@ -7569,7 +7804,9 @@ typedef struct LDKPayer_JCalls { uint32_t node_id_meth; uint32_t first_hops_meth; uint32_t send_payment_meth; + uint32_t send_spontaneous_payment_meth; uint32_t retry_payment_meth; + uint32_t abandon_payment_meth; } LDKPayer_JCalls; static void LDKPayer_JCalls_free(void* this_arg) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; @@ -7577,7 +7814,9 @@ static void LDKPayer_JCalls_free(void* this_arg) { js_free(j_calls->node_id_meth); js_free(j_calls->first_hops_meth); js_free(j_calls->send_payment_meth); + js_free(j_calls->send_spontaneous_payment_meth); js_free(j_calls->retry_payment_meth); + js_free(j_calls->abandon_payment_meth); FREE(j_calls); } } @@ -7632,6 +7871,27 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* FREE((void*)ret); return ret_conv; } +LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(route); + CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = (uint64_t)route_var.inner; + if (route_var.is_owned) { + route_ref |= 1; + } + int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_preimage_arr + 4), payment_preimage.data, 32); + uint32_t ret = js_invoke_function_2(j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr); + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); + FREE((void*)ret); + return ret_conv; +} LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; LDKRoute route_var = *route; @@ -7653,6 +7913,12 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this FREE((void*)ret); return ret_conv; } +void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32); + js_invoke_function_1(j_calls->abandon_payment_meth, payment_id_arr); +} static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -7667,7 +7933,9 @@ static inline LDKPayer LDKPayer_init (/*TODO: JS Object Reference */void* o) { .node_id = node_id_LDKPayer_jcall, .first_hops = first_hops_LDKPayer_jcall, .send_payment = send_payment_LDKPayer_jcall, + .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, .retry_payment = retry_payment_LDKPayer_jcall, + .abandon_payment = abandon_payment_LDKPayer_jcall, .free = LDKPayer_JCalls_free, }; return ret; @@ -7730,6 +7998,22 @@ uint32_t __attribute__((visibility("default"))) TS_Payer_send_payment(uint32_t return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_Payer_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK(*((uint32_t*)payment_preimage) == 32); + memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -7746,6 +8030,16 @@ uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t return (uint64_t)ret_conv; } +void __attribute__((visibility("default"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); +} + typedef struct LDKRouter_JCalls { atomic_size_t refcnt; uint32_t find_route_meth; @@ -7757,7 +8051,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; int8_tArray payer_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(payer_arr + 4), payer.compressed_form, 33); @@ -7771,6 +8065,8 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, if (params_var.is_owned) { params_ref |= 1; } + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), *payment_hash, 32); LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; uint32_tArray first_hops_arr = NULL; if (first_hops != NULL) { @@ -7793,7 +8089,7 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, } // WARNING: This object doesn't live past this scope, needs clone! uint64_t ret_scorer = ((uint64_t)scorer) | 1; - uint32_t ret = js_invoke_function_4(j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer); + uint32_t ret = js_invoke_function_5(j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer); void* ret_ptr = (void*)(((uint64_t)ret) & ~1); CHECK_ACCESS(ret_ptr); LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); @@ -7821,7 +8117,7 @@ long __attribute__((visibility("default"))) TS_LDKRouter_new(/*TODO: JS Object *res_ptr = LDKRouter_init(o); return (long)res_ptr; } -uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, uint32_tArray first_hops, uint32_t scorer) { +uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, int8_tArray payment_hash, uint32_tArray first_hops, uint32_t scorer) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; @@ -7832,6 +8128,10 @@ uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t t params_conv.inner = (void*)(params & (~1)); params_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + unsigned char payment_hash_arr[32]; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32); + unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; LDKCVec_ChannelDetailsZ first_hops_constr; LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; if (first_hops != 0) { @@ -7855,7 +8155,7 @@ uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t t if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } @@ -8264,6 +8564,21 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitme return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_some() { + uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some()); + return ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_none() { + uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none()); + return ret_conv; +} + +void __attribute__((visibility("default"))) TS_COption_NoneZ_free(uint32_t _res) { + LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res); + COption_NoneZ_free(_res_conv); +} + uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) { LDKCounterpartyChannelTransactionParameters o_conv; o_conv.inner = (void*)(o & (~1)); @@ -9894,78 +10209,115 @@ void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint CVec_MessageSendEventZ_free(_res_constr); } -uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) { - LDKInitFeatures o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) { + LDKScoringParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InitFeatures_clone(&o_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScoringParameters + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InitFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScoringParametersDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) { - LDKNodeFeatures o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) { + LDKScorer o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = NodeFeatures_clone(&o_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScorer + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScorerDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKInitFeatures o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = InitFeatures_clone(&o_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_InitFeaturesDecodeErrorZ_free(_res_conv); } uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) { @@ -10005,115 +10357,115 @@ void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErr CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) { - LDKInvoiceFeatures o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKNodeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InvoiceFeatures_clone(&o_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); + o_conv = NodeFeatures_clone(&o_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); + CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) { - LDKScoringParameters o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKInvoiceFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); + o_conv = InvoiceFeatures_clone(&o_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); + LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScoringParametersDecodeErrorZ_free(_res_conv); + CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) { - LDKScorer o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKChannelTypeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScorer - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); + o_conv = ChannelTypeFeatures_clone(&o_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScorerDecodeErrorZ_free(_res_conv); + CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv); } uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) { @@ -11338,6 +11690,156 @@ void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecret C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv); } +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(*((uint32_t*)o) == 32); + memcpy(o_ref.data, (uint8_t*)(o + 4), 32); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_err() { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_err(); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) { + LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1); + jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentSecretNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) { + LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) { + LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK(*((uint32_t*)o) == 32); @@ -11390,6 +11892,58 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErro return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(*((uint32_t*)o) == 32); + memcpy(o_ref.data, (uint8_t*)(o + 4), 32); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) { + LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentPreimageAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) { + LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) { LDKCVec_ChannelMonitorZ _res_constr; _res_constr.datalen = *((uint32_t*)_res); @@ -12533,56 +13087,6 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErro return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok(); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) { - LDKMonitorUpdateError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = MonitorUpdateError_clone(&e_conv); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv); - return (uint64_t)ret_conv; -} - -jboolean __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_is_ok(uint32_t o) { - LDKCResult_NoneMonitorUpdateErrorZ* o_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(o & ~1); - jboolean ret_val = CResult_NoneMonitorUpdateErrorZ_is_ok(o_conv); - return ret_val; -} - -void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_NoneMonitorUpdateErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(arg); - return (uint64_t)ret_conv; -} -int64_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone_ptr(uint32_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ* arg_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - int64_t ret_val = CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) { - LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv); - return (uint64_t)ret_conv; -} - static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) { LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ"); *ret_conv = C2Tuple_OutPointScriptZ_clone(arg); @@ -15993,7 +16497,7 @@ uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_ return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) { +uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) { LDKThirtyTwoBytes payment_preimage_ref; CHECK(*((uint32_t*)payment_preimage) == 32); memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); @@ -16001,7 +16505,7 @@ uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payme CHECK(*((uint32_t*)payment_secret) == 32); memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32); LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose"); - *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id); + *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -16074,6 +16578,13 @@ uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_ return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_ClosureReason_funding_timed_out() { + LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); + *ret_copy = ClosureReason_funding_timed_out(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) { LDKStr err_conv = str_ref_to_owned_c(err); LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); @@ -16233,6 +16744,19 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(in return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) { LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); *ret_copy = Event_pending_htlcs_forwardable(time_forwardable); @@ -16302,6 +16826,35 @@ uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_t return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) { + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = *((uint32_t*)path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + uint32_t* path_vals = (uint32_t*)(path + 4); + for (size_t k = 0; k < path_constr.datalen; k++) { + uint32_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -16777,6 +17330,11 @@ uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) { return ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_Level_gossip() { + uint32_t ret_conv = LDKLevel_to_js(Level_gossip()); + return ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_Level_trace() { uint32_t ret_conv = LDKLevel_to_js(Level_trace()); return ret_conv; @@ -17628,7 +18186,24 @@ void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_t UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) { +jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UserConfig_set_accept_inbound_channels(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) { LDKChannelHandshakeConfig own_channel_config_arg_conv; own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1)); own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0); @@ -17644,7 +18219,7 @@ uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_ channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); - LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg); + LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -18425,86 +19000,6 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(in return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) { - LDKMonitorUpdateError this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - MonitorUpdateError_free(this_obj_conv); -} - -jstring __attribute__((visibility("default"))) TS_MonitorUpdateError_get_a(uint32_t this_ptr) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv); - jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len); - Str_free(ret_str); - return ret_conv; -} - -void __attribute__((visibility("default"))) TS_MonitorUpdateError_set_a(uint32_t this_ptr, jstring val) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr val_conv = str_ref_to_owned_c(val); - MonitorUpdateError_set_a(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_new(jstring a_arg) { - LDKStr a_arg_conv = str_ref_to_owned_c(a_arg); - LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg) { - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(arg); -uint64_t ret_ref = 0; -CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. -CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. -CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); -ret_ref = (uint64_t)ret_var.inner; -if (ret_var.is_owned) { - ret_ref |= 1; -} - return ret_ref; -} -int64_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone_ptr(uint32_t arg) { - LDKMonitorUpdateError arg_conv; - arg_conv.inner = (void*)(arg & (~1)); - arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - int64_t ret_val = MonitorUpdateError_clone_ptr(&arg_conv); - return ret_val; -} - -uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) { - LDKMonitorUpdateError orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); @@ -18807,7 +19302,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_update_monito void* logger_ptr = (void*)(((uint64_t)logger) & ~1); if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv); return (uint64_t)ret_conv; } @@ -20143,6 +20638,15 @@ uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_p return ret_ref; } +jboolean __attribute__((visibility("default"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv); + return ret_val; +} + uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -20896,6 +21400,23 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_ ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } +int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ChannelDetails_set_balance_msat(&this_ptr_conv, val); +} + int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -21044,7 +21565,7 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uin ChannelDetails_set_is_public(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK(*((uint32_t*)channel_id_arg) == 32); memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32); @@ -21073,7 +21594,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArr CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1)); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -21448,6 +21969,17 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment return (uint64_t)ret_conv; } +void __attribute__((visibility("default"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref); +} + uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -21563,7 +22095,7 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_no return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -21572,12 +22104,43 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inboun CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); - LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); - return ((uint64_t)ret_conv); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_legacy(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash_legacy(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -21590,7 +22153,23 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inboun LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); + *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + LDKThirtyTwoBytes payment_secret_ref; + CHECK(*((uint32_t*)payment_secret) == 32); + memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } @@ -22654,6 +23233,38 @@ void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(ui OpenChannel_set_channel_flags(&this_ptr_conv, val); } +uint32_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv); + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + OpenChannel_set_channel_type(&this_ptr_conv, val_conv); +} + static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) { LDKOpenChannel ret_var = OpenChannel_clone(arg); uint64_t ret_ref = 0; @@ -24957,12 +25568,12 @@ uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) { - LDKTenBytes addr_ref; - CHECK(*((uint32_t*)addr) == 10); - memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10); +uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray a) { + LDKTwelveBytes a_ref; + CHECK(*((uint32_t*)a) == 12); + memcpy(a_ref.data, (uint8_t*)(a + 4), 12); LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); - *ret_copy = NetAddress_onion_v2(addr_ref, port); + *ret_copy = NetAddress_onion_v2(a_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -26651,6 +27262,13 @@ uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(u return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_duplicate_gossip() { + LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction"); + *ret_copy = ErrorAction_ignore_duplicate_gossip(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) { LDKErrorMessage msg_conv; msg_conv.inner = (void*)(msg & (~1)); @@ -28313,6 +28931,16 @@ void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred( PeerManager_timer_tick_occurred(&this_arg_conv); } +int64_t __attribute__((visibility("default"))) TS_htlc_success_tx_weight(jboolean opt_anchors) { + int64_t ret_val = htlc_success_tx_weight(opt_anchors); + return ret_val; +} + +int64_t __attribute__((visibility("default"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) { + int64_t ret_val = htlc_timeout_tx_weight(opt_anchors); + return ret_val; +} + int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) { unsigned char commitment_seed_arr[32]; CHECK(*((uint32_t*)commitment_seed) == 32); @@ -29029,7 +29657,7 @@ uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read( return (uint64_t)ret_conv; } -int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) { +int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) { LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = false; @@ -29038,7 +29666,7 @@ int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uin keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv); - LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); + LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); @@ -29059,7 +29687,7 @@ int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { +int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { unsigned char commitment_txid_arr[32]; CHECK(*((uint32_t*)commitment_txid) == 32); memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32); @@ -29074,13 +29702,24 @@ int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(in LDKPublicKey revocation_key_ref; CHECK(*((uint32_t*)revocation_key) == 33); memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33); - LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); + LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); Transaction_free(ret_var); return ret_arr; } +int8_tArray __attribute__((visibility("default"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) { + LDKPublicKey funding_pubkey_ref; + CHECK(*((uint32_t*)funding_pubkey) == 33); + memcpy(funding_pubkey_ref.compressed_form, (uint8_t*)(funding_pubkey + 4), 33); + LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) { LDKChannelTransactionParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -29217,7 +29856,25 @@ void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg) { +uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv)); + return ret_conv; +} + +void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val); + ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg, uint32_t opt_anchors_arg) { LDKChannelPublicKeys holder_pubkeys_arg_conv; holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1)); holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0); @@ -29233,7 +29890,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv); funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv); - LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv); + LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg); + LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -29556,6 +30214,15 @@ uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionPa return ret_ref; } +jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) { + LDKDirectedChannelTransactionParameters this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv); + return ret_val; +} + void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) { LDKHolderCommitmentTransaction this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -30268,6 +30935,15 @@ uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction return ret_ref; } +jboolean __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) { + LDKTrustedCommitmentTransaction this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv); + return ret_val; +} + uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) { LDKTrustedCommitmentTransaction this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -30349,6 +31025,19 @@ jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t return ret_val; } +jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) { + LDKChannelTypeFeatures a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + LDKChannelTypeFeatures b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv); + return ret_val; +} + static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) { LDKInitFeatures ret_var = InitFeatures_clone(arg); uint64_t ret_ref = 0; @@ -30501,6 +31190,44 @@ uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32 return ret_ref; } +static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); +uint64_t ret_ref = 0; +CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uint64_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +int64_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) { + LDKChannelTypeFeatures arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone(uint32_t orig) { + LDKChannelTypeFeatures orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) { LDKInitFeatures this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -30533,6 +31260,14 @@ void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t th InvoiceFeatures_free(this_obj_conv); } +void __attribute__((visibility("default"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) { + LDKChannelTypeFeatures this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ChannelTypeFeatures_free(this_obj_conv); +} + uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() { LDKInitFeatures ret_var = InitFeatures_empty(); uint64_t ret_ref = 0; @@ -30673,30 +31408,38 @@ jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unk return ret_val; } -jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) { - LDKInitFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_empty() { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) { - LDKNodeFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_known() { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) { - LDKInvoiceFeatures this_arg_conv; +jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv); + jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv); return ret_val; } @@ -30712,16 +31455,13 @@ int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32 return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) { - LDKNodeFeatures obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; +uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = InitFeatures_read(ser_ref); + return (uint64_t)ret_conv; } int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) { @@ -30736,27 +31476,27 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uin return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) { - LDKInvoiceFeatures obj_conv; +uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); + *ret_conv = ChannelFeatures_read(ser_ref); + return (uint64_t)ret_conv; +} + +int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) { + LDKNodeFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = InitFeatures_read(ser_ref); - return (uint64_t)ret_conv; -} - uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); @@ -30766,21 +31506,45 @@ uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArra return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) { +int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) { + LDKInvoiceFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); - *ret_conv = ChannelFeatures_read(ser_ref); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = InvoiceFeatures_read(ser_ref); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) { +int8_tArray __attribute__((visibility("default"))) TS_ChannelTypeFeatures_write(uint32_t obj) { + LDKChannelTypeFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = InvoiceFeatures_read(ser_ref); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); return (uint64_t)ret_conv; } @@ -31056,51 +31820,6 @@ void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) { Type_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); - CHECK_ACCESS(this_ptr_ptr); - LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); - FREE((void*)this_ptr); - Score_free(this_ptr_conv); -} - -void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_obj) { - LDKLockableScore this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - LockableScore_free(this_obj_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_LockableScore_new(uint32_t score) { - void* score_ptr = (void*)(((uint64_t)score) & ~1); - CHECK_ACCESS(score_ptr); - LDKScore score_conv = *(LDKScore*)(score_ptr); - LDKLockableScore ret_var = LockableScore_new(score_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -int8_tArray __attribute__((visibility("default"))) TS_LockableScore_write(uint32_t obj) { - LDKLockableScore obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -31878,53 +32597,6 @@ void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_mes ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) { - LDKChannelFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv); - features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKNodeId node_one_arg_conv; - node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); - node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_one_arg_conv); - node_one_arg_conv = NodeId_clone(&node_one_arg_conv); - LDKDirectionalChannelInfo one_to_two_arg_conv; - one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); - one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(one_to_two_arg_conv); - one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKNodeId node_two_arg_conv; - node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); - node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_two_arg_conv); - node_two_arg_conv = NodeId_clone(&node_two_arg_conv); - LDKDirectionalChannelInfo two_to_one_arg_conv; - two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); - two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(two_to_one_arg_conv); - two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); - void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1); - CHECK_ACCESS(capacity_sats_arg_ptr); - LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr); - capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); - LDKChannelAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv); - announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) { LDKChannelInfo ret_var = ChannelInfo_clone(arg); uint64_t ret_ref = 0; @@ -32701,6 +33373,14 @@ void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } +void __attribute__((visibility("default"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix); +} + uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -34141,6 +34821,48 @@ uint32_t __attribute__((visibility("default"))) TS_find_route(int8_tArray our_n return (uint64_t)ret_conv; } +void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); +} + +void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + LockableScore_free(this_ptr_conv); +} + +void __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) { + LDKMultiThreadedLockableScore this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + MultiThreadedLockableScore_free(this_obj_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_new(uint32_t score) { + void* score_ptr = (void*)(((uint64_t)score) & ~1); + CHECK_ACCESS(score_ptr); + LDKScore score_conv = *(LDKScore*)(score_ptr); + LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -34191,6 +34913,40 @@ void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_pe ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val); } +int16_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val); +} + +int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val); +} + int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) { LDKScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -34208,8 +34964,8 @@ void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_pe ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) { - LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); +uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) { + LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -36124,6 +36880,11 @@ uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_ou return ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CreationError_invalid_amount() { + uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount()); + return ret_conv; +} + jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) { LDKCreationError* a_conv = (LDKCreationError*)(a & ~1); LDKCreationError* b_conv = (LDKCreationError*)(b & ~1); @@ -36460,7 +37221,7 @@ uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_new(uint32_t pa void* router_ptr = (void*)(((uint64_t)router) & ~1); CHECK_ACCESS(router_ptr); LDKRouter router_conv = *(LDKRouter*)(router_ptr); - LDKLockableScore scorer_conv; + LDKMultiThreadedLockableScore scorer_conv; scorer_conv.inner = (void*)(scorer & (~1)); scorer_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv); @@ -36515,6 +37276,22 @@ uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_zero_value_ return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_pubkey(uint32_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKPublicKey pubkey_ref; + CHECK(*((uint32_t*)pubkey) == 33); + memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK(*((uint32_t*)payment_preimage) == 32); + memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); + return (uint64_t)ret_conv; +} + void __attribute__((visibility("default"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); diff --git a/ts/bindings.c.body b/ts/bindings.c.body index 27e39255..0540b49d 100644 --- a/ts/bindings.c.body +++ b/ts/bindings.c.body @@ -83,6 +83,20 @@ static inline int32_t LDKAccessError_to_js(LDKAccessError val) { default: abort(); } } +static inline LDKCOption_NoneZ LDKCOption_NoneZ_from_js(int32_t ord) { + switch (ord) { + case 0: return LDKCOption_NoneZ_Some; + case 1: return LDKCOption_NoneZ_None; + } + abort(); +} +static inline int32_t LDKCOption_NoneZ_to_js(LDKCOption_NoneZ val) { + switch (val) { + case LDKCOption_NoneZ_Some: return 0; + case LDKCOption_NoneZ_None: return 1; + default: abort(); + } +} static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_js(int32_t ord) { switch (ord) { case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure; @@ -119,6 +133,7 @@ static inline LDKCreationError LDKCreationError_from_js(int32_t ord) { case 1: return LDKCreationError_RouteTooLong; case 2: return LDKCreationError_TimestampOutOfBounds; case 3: return LDKCreationError_ExpiryTimeOutOfBounds; + case 4: return LDKCreationError_InvalidAmount; } abort(); } @@ -128,6 +143,7 @@ static inline int32_t LDKCreationError_to_js(LDKCreationError val) { case LDKCreationError_RouteTooLong: return 1; case LDKCreationError_TimestampOutOfBounds: return 2; case LDKCreationError_ExpiryTimeOutOfBounds: return 3; + case LDKCreationError_InvalidAmount: return 4; default: abort(); } } @@ -199,21 +215,23 @@ static inline int32_t LDKIOError_to_js(LDKIOError val) { } static inline LDKLevel LDKLevel_from_js(int32_t ord) { switch (ord) { - case 0: return LDKLevel_Trace; - case 1: return LDKLevel_Debug; - case 2: return LDKLevel_Info; - case 3: return LDKLevel_Warn; - case 4: return LDKLevel_Error; + case 0: return LDKLevel_Gossip; + case 1: return LDKLevel_Trace; + case 2: return LDKLevel_Debug; + case 3: return LDKLevel_Info; + case 4: return LDKLevel_Warn; + case 5: return LDKLevel_Error; } abort(); } static inline int32_t LDKLevel_to_js(LDKLevel val) { switch (val) { - case LDKLevel_Trace: return 0; - case LDKLevel_Debug: return 1; - case LDKLevel_Info: return 2; - case LDKLevel_Warn: return 3; - case LDKLevel_Error: return 4; + case LDKLevel_Gossip: return 0; + case LDKLevel_Trace: return 1; + case LDKLevel_Debug: return 2; + case LDKLevel_Info: return 3; + case LDKLevel_Warn: return 4; + case LDKLevel_Error: return 5; default: abort(); } } @@ -1009,6 +1027,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr case LDKClosureReason_CommitmentTxConfirmed: { return 0 /* LDKClosureReason - CommitmentTxConfirmed */; } + case LDKClosureReason_FundingTimedOut: { + return 0 /* LDKClosureReason - FundingTimedOut */; + } case LDKClosureReason_ProcessingError: { LDKStr err_str = obj->processing_error.err; jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len); @@ -1138,7 +1159,7 @@ uint32_t __attribute__((visibility("default"))) TS_LDKPaymentPurpose_ref_from_pt memcpy((uint8_t*)(payment_preimage_arr + 4), obj->invoice_payment.payment_preimage.data, 32); int8_tArray payment_secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(payment_secret_arr + 4), obj->invoice_payment.payment_secret.data, 32); - return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; (void) obj->invoice_payment.user_payment_id; + return 0 /* LDKPaymentPurpose - InvoicePayment */; (void) payment_preimage_arr; (void) payment_secret_arr; } case LDKPaymentPurpose_SpontaneousPayment: { int8_tArray spontaneous_payment_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -1206,6 +1227,13 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ } return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_id_arr; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr; (void) short_channel_id_ref; (void) retry_ref; } + case LDKEvent_PaymentFailed: { + int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_failed.payment_id.data, 32); + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32); + return 0 /* LDKEvent - PaymentFailed */; (void) payment_id_arr; (void) payment_hash_arr; + } case LDKEvent_PendingHTLCsForwardable: { return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable; } @@ -1239,6 +1267,27 @@ uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_ memcpy((uint8_t*)(transaction_arr + 4), transaction_var.data, transaction_var.datalen); return 0 /* LDKEvent - DiscardFunding */; (void) channel_id_arr; (void) transaction_arr; } + case LDKEvent_PaymentPathSuccessful: { + int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_id_arr + 4), obj->payment_path_successful.payment_id.data, 32); + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_successful.payment_hash.data, 32); + LDKCVec_RouteHopZ path_var = obj->payment_path_successful.path; + uint32_tArray path_arr = NULL; + path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1; + path_arr_ptr[k] = path_conv_10_ref; + } + + return 0 /* LDKEvent - PaymentPathSuccessful */; (void) payment_id_arr; (void) payment_hash_arr; (void) path_arr; + } default: abort(); } } @@ -1293,6 +1342,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKErrorAction_ref_from_ptr(u uint32_t ignore_and_log_conv = LDKLevel_to_js(obj->ignore_and_log); return 0 /* LDKErrorAction - IgnoreAndLog */; (void) ignore_and_log_conv; } + case LDKErrorAction_IgnoreDuplicateGossip: { + return 0 /* LDKErrorAction - IgnoreDuplicateGossip */; + } case LDKErrorAction_SendErrorMessage: { LDKErrorMessage msg_var = obj->send_error_message.msg; uint64_t msg_ref = 0; @@ -1522,10 +1574,10 @@ static inline LDKCVec_MessageSendEventZ CVec_MessageSendEventZ_clone(const LDKCV } return ret; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInitFeatures res_var = (*val->contents.result); + LDKScoringParameters res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1533,8 +1585,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecod res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1544,10 +1596,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecod err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKNodeFeatures res_var = (*val->contents.result); + LDKScorer res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1555,8 +1607,30 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecod res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + LDKDecodeError err_var = (*val->contents.err); + uint64_t err_ref = 0; + CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); + err_ref = (uint64_t)err_var.inner & ~1; + return err_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKInitFeatures res_var = (*val->contents.result); + uint64_t res_ref = 0; + CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(res_var); + res_ref = (uint64_t)res_var.inner & ~1; + return res_ref; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InitFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_InitFeaturesDecodeErrorZ *val = (LDKCResult_InitFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1588,10 +1662,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelFeaturesDe err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKInvoiceFeatures res_var = (*val->contents.result); + LDKNodeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1599,8 +1673,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDe res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NodeFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_NodeFeaturesDecodeErrorZ *val = (LDKCResult_NodeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1610,10 +1684,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDe err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScoringParameters res_var = (*val->contents.result); + LDKInvoiceFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1621,8 +1695,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParameters res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParametersDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_ScoringParametersDecodeErrorZ *val = (LDKCResult_ScoringParametersDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_InvoiceFeaturesDecodeErrorZ *val = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -1632,10 +1706,10 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScoringParameters err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_ok(uint32_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(uint32_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(val->result_ok); - LDKScorer res_var = (*val->contents.result); + LDKChannelTypeFeatures res_var = (*val->contents.result); uint64_t res_ref = 0; CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -1643,8 +1717,8 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeError res_ref = (uint64_t)res_var.inner & ~1; return res_ref; } -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ScorerDecodeErrorZ_get_err(uint32_t arg) { - LDKCResult_ScorerDecodeErrorZ *val = (LDKCResult_ScorerDecodeErrorZ*)(arg & ~1); +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(uint32_t arg) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ *val = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(arg & ~1); CHECK(!val->result_ok); LDKDecodeError err_var = (*val->contents.err); uint64_t err_ref = 0; @@ -2699,9 +2773,9 @@ uint32_t __attribute__((visibility("default"))) TS_LDKNetAddress_ref_from_ptr(ui return 0 /* LDKNetAddress - IPv6 */; (void) addr_arr; (void) obj->i_pv6.port; } case LDKNetAddress_OnionV2: { - int8_tArray addr_arr = init_arr(10, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(addr_arr + 4), obj->onion_v2.addr.data, 10); - return 0 /* LDKNetAddress - OnionV2 */; (void) addr_arr; (void) obj->onion_v2.port; + int8_tArray onion_v2_arr = init_arr(12, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(onion_v2_arr + 4), obj->onion_v2.data, 12); + return 0 /* LDKNetAddress - OnionV2 */; (void) onion_v2_arr; } case LDKNetAddress_OnionV3: { int8_tArray ed25519_pubkey_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); @@ -2738,6 +2812,45 @@ int8_tArray __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymen return ret_arr; } +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +void __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + LDKC2Tuple_PaymentHashPaymentSecretZ* res_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); + *res_conv = (*val->contents.result); + *res_conv = C2Tuple_PaymentHashPaymentSecretZ_clone(res_conv); + return ((uint64_t)res_conv); +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *val = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretNoneZ_get_ok(uint32_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); + return res_arr; +} +void __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretNoneZ_get_err(uint32_t arg) { + LDKCResult_PaymentSecretNoneZ *val = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + CHECK(!val->result_ok); + return *val->contents.err; +} int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIErrorZ_get_ok(uint32_t arg) { LDKCResult_PaymentSecretAPIErrorZ *val = (LDKCResult_PaymentSecretAPIErrorZ*)(arg & ~1); CHECK(val->result_ok); @@ -2751,6 +2864,19 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentSecretAPIE uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; return err_ref; } +int8_tArray __attribute__((visibility("default"))) TS_LDKCResult_PaymentPreimageAPIErrorZ_get_ok(uint32_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(val->result_ok); + int8_tArray res_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(res_arr + 4), (*val->contents.result).data, 32); + return res_arr; +} +uint32_t __attribute__((visibility("default"))) TS_LDKCResult_PaymentPreimageAPIErrorZ_get_err(uint32_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ *val = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + CHECK(!val->result_ok); + uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1; + return err_ref; +} static inline LDKCVec_ChannelMonitorZ CVec_ChannelMonitorZ_clone(const LDKCVec_ChannelMonitorZ *orig) { LDKCVec_ChannelMonitorZ ret = { .data = MALLOC(sizeof(LDKChannelMonitor) * orig->datalen, "LDKCVec_ChannelMonitorZ clone bytes"), .datalen = orig->datalen }; for (size_t i = 0; i < ret.datalen; i++) { @@ -2988,6 +3114,7 @@ typedef struct LDKKeysInterface_JCalls { uint32_t get_secure_random_bytes_meth; uint32_t read_chan_signer_meth; uint32_t sign_invoice_meth; + uint32_t get_inbound_payment_key_material_meth; } LDKKeysInterface_JCalls; static void LDKKeysInterface_JCalls_free(void* this_arg) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; @@ -2999,6 +3126,7 @@ static void LDKKeysInterface_JCalls_free(void* this_arg) { js_free(j_calls->get_secure_random_bytes_meth); js_free(j_calls->read_chan_signer_meth); js_free(j_calls->sign_invoice_meth); + js_free(j_calls->get_inbound_payment_key_material_meth); FREE(j_calls); } } @@ -3070,6 +3198,14 @@ LDKCResult_RecoverableSignatureNoneZ sign_invoice_LDKKeysInterface_jcall(const v FREE((void*)ret); return ret_conv; } +LDKThirtyTwoBytes get_inbound_payment_key_material_LDKKeysInterface_jcall(const void* this_arg) { + LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg; + int8_tArray ret = js_invoke_function_0(j_calls->get_inbound_payment_key_material_meth); + LDKThirtyTwoBytes ret_ref; + CHECK(*((uint32_t*)ret) == 32); + memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32); + return ret_ref; +} static void LDKKeysInterface_JCalls_cloned(LDKKeysInterface* new_obj) { LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -3088,6 +3224,7 @@ static inline LDKKeysInterface LDKKeysInterface_init (/*TODO: JS Object Referenc .get_secure_random_bytes = get_secure_random_bytes_LDKKeysInterface_jcall, .read_chan_signer = read_chan_signer_LDKKeysInterface_jcall, .sign_invoice = sign_invoice_LDKKeysInterface_jcall, + .get_inbound_payment_key_material = get_inbound_payment_key_material_LDKKeysInterface_jcall, .free = LDKKeysInterface_JCalls_free, }; return ret; @@ -3176,6 +3313,15 @@ uint32_t __attribute__((visibility("default"))) TS_KeysInterface_sign_invoice(u return (uint64_t)ret_conv; } +int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_inbound_payment_key_material(uint32_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg_ptr; + int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), (this_arg_conv->get_inbound_payment_key_material)(this_arg_conv->this_arg).data, 32); + return ret_arr; +} + typedef struct LDKFeeEstimator_JCalls { atomic_size_t refcnt; uint32_t get_est_sat_per_1000_weight_meth; @@ -3803,22 +3949,6 @@ uint32_t __attribute__((visibility("default"))) TS_LDKCResult_HTLCUpdateDecodeE err_ref = (uint64_t)err_var.inner & ~1; return err_ref; } -void __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_ok(uint32_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(val->result_ok); - return *val->contents.result; -} -uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneMonitorUpdateErrorZ_get_err(uint32_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - CHECK(!val->result_ok); - LDKMonitorUpdateError err_var = (*val->contents.err); - uint64_t err_ref = 0; - CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(err_var); - err_ref = (uint64_t)err_var.inner & ~1; - return err_ref; -} static inline struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple){ return OutPoint_clone(&tuple->a); } @@ -7336,6 +7466,7 @@ typedef struct LDKScore_JCalls { atomic_size_t refcnt; uint32_t channel_penalty_msat_meth; uint32_t payment_path_failed_meth; + uint32_t payment_path_successful_meth; uint32_t write_meth; } LDKScore_JCalls; static void LDKScore_JCalls_free(void* this_arg) { @@ -7343,12 +7474,16 @@ static void LDKScore_JCalls_free(void* this_arg) { if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { js_free(j_calls->channel_penalty_msat_meth); js_free(j_calls->payment_path_failed_meth); + js_free(j_calls->payment_path_successful_meth); js_free(j_calls->write_meth); FREE(j_calls); } } -uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, const LDKNodeId * source, const LDKNodeId * target) { +uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, LDKCOption_u64Z channel_capacity_msat, const LDKNodeId * source, const LDKNodeId * target) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + LDKCOption_u64Z *channel_capacity_msat_copy = MALLOC(sizeof(LDKCOption_u64Z), "LDKCOption_u64Z"); + *channel_capacity_msat_copy = channel_capacity_msat; + uint64_t channel_capacity_msat_ref = (uint64_t)channel_capacity_msat_copy; LDKNodeId source_var = *source; uint64_t source_ref = 0; source_var = NodeId_clone(source); @@ -7369,7 +7504,7 @@ uint64_t channel_penalty_msat_LDKScore_jcall(const void* this_arg, uint64_t shor if (target_var.is_owned) { target_ref |= 1; } - return js_invoke_function_3(j_calls->channel_penalty_msat_meth, short_channel_id, source_ref, target_ref); + return js_invoke_function_5(j_calls->channel_penalty_msat_meth, short_channel_id, send_amt_msat, channel_capacity_msat_ref, source_ref, target_ref); } void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, uint64_t short_channel_id) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; @@ -7393,6 +7528,28 @@ void payment_path_failed_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path, FREE(path_var.data); js_invoke_function_2(j_calls->payment_path_failed_meth, path_arr, short_channel_id); } +void payment_path_successful_LDKScore_jcall(void* this_arg, LDKCVec_RouteHopZ path) { + LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; + LDKCVec_RouteHopZ path_var = path; + uint32_tArray path_arr = NULL; + path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes"); + uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4); + for (size_t k = 0; k < path_var.datalen; k++) { + LDKRouteHop path_conv_10_var = path_var.data[k]; + uint64_t path_conv_10_ref = 0; + CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_var); + path_conv_10_ref = (uint64_t)path_conv_10_var.inner; + if (path_conv_10_var.is_owned) { + path_conv_10_ref |= 1; + } + path_arr_ptr[k] = path_conv_10_ref; + } + + FREE(path_var.data); + js_invoke_function_1(j_calls->payment_path_successful_meth, path_arr); +} LDKCVec_u8Z write_LDKScore_jcall(const void* this_arg) { LDKScore_JCalls *j_calls = (LDKScore_JCalls*) this_arg; int8_tArray ret = js_invoke_function_0(j_calls->write_meth); @@ -7415,6 +7572,7 @@ static inline LDKScore LDKScore_init (/*TODO: JS Object Reference */void* o) { .this_arg = (void*) calls, .channel_penalty_msat = channel_penalty_msat_LDKScore_jcall, .payment_path_failed = payment_path_failed_LDKScore_jcall, + .payment_path_successful = payment_path_successful_LDKScore_jcall, .write = write_LDKScore_jcall, .free = LDKScore_JCalls_free, }; @@ -7425,10 +7583,14 @@ long __attribute__((visibility("default"))) TS_LDKScore_new(/*TODO: JS Object R *res_ptr = LDKScore_init(o); return (long)res_ptr; } -int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, uint32_t source, uint32_t target) { +int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(uint32_t this_arg, int64_t short_channel_id, int64_t send_amt_msat, uint32_t channel_capacity_msat, uint32_t source, uint32_t target) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + void* channel_capacity_msat_ptr = (void*)(((uint64_t)channel_capacity_msat) & ~1); + CHECK_ACCESS(channel_capacity_msat_ptr); + LDKCOption_u64Z channel_capacity_msat_conv = *(LDKCOption_u64Z*)(channel_capacity_msat_ptr); + channel_capacity_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)channel_capacity_msat) & ~1)); LDKNodeId source_conv; source_conv.inner = (void*)(source & (~1)); source_conv.is_owned = false; @@ -7437,7 +7599,7 @@ int64_t __attribute__((visibility("default"))) TS_Score_channel_penalty_msat(ui target_conv.inner = (void*)(target & (~1)); target_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(target_conv); - int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, &source_conv, &target_conv); + int64_t ret_val = (this_arg_conv->channel_penalty_msat)(this_arg_conv->this_arg, short_channel_id, send_amt_msat, channel_capacity_msat_conv, &source_conv, &target_conv); return ret_val; } @@ -7464,6 +7626,29 @@ void __attribute__((visibility("default"))) TS_Score_payment_path_failed(uint32 (this_arg_conv->payment_path_failed)(this_arg_conv->this_arg, path_constr, short_channel_id); } +void __attribute__((visibility("default"))) TS_Score_payment_path_successful(uint32_t this_arg, uint32_tArray path) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKScore* this_arg_conv = (LDKScore*)this_arg_ptr; + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = *((uint32_t*)path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + uint32_t* path_vals = (uint32_t*)(path + 4); + for (size_t k = 0; k < path_constr.datalen; k++) { + uint32_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + (this_arg_conv->payment_path_successful)(this_arg_conv->this_arg, path_constr); +} + int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this_arg) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -7475,6 +7660,56 @@ int8_tArray __attribute__((visibility("default"))) TS_Score_write(uint32_t this return ret_arr; } +typedef struct LDKLockableScore_JCalls { + atomic_size_t refcnt; + uint32_t lock_meth; +} LDKLockableScore_JCalls; +static void LDKLockableScore_JCalls_free(void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) { + js_free(j_calls->lock_meth); + FREE(j_calls); + } +} +LDKScore lock_LDKLockableScore_jcall(const void* this_arg) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) this_arg; + uint32_t ret = js_invoke_function_0(j_calls->lock_meth); + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKScore ret_conv = *(LDKScore*)(ret_ptr);// Warning: we may need a move here but no clone is available for LDKScore + + return ret_conv; +} +static void LDKLockableScore_JCalls_cloned(LDKLockableScore* new_obj) { + LDKLockableScore_JCalls *j_calls = (LDKLockableScore_JCalls*) new_obj->this_arg; + atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); +} +static inline LDKLockableScore LDKLockableScore_init (/*TODO: JS Object Reference */void* o) { + LDKLockableScore_JCalls *calls = MALLOC(sizeof(LDKLockableScore_JCalls), "LDKLockableScore_JCalls"); + atomic_init(&calls->refcnt, 1); + //TODO: Assign calls->o from o + + LDKLockableScore ret = { + .this_arg = (void*) calls, + .lock = lock_LDKLockableScore_jcall, + .free = LDKLockableScore_JCalls_free, + }; + return ret; +} +long __attribute__((visibility("default"))) TS_LDKLockableScore_new(/*TODO: JS Object Reference */void* o) { + LDKLockableScore *res_ptr = MALLOC(sizeof(LDKLockableScore), "LDKLockableScore"); + *res_ptr = LDKLockableScore_init(o); + return (long)res_ptr; +} +uint32_t __attribute__((visibility("default"))) TS_LockableScore_lock(uint32_t this_arg) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKLockableScore* this_arg_conv = (LDKLockableScore*)this_arg_ptr; + LDKScore* ret_ret = MALLOC(sizeof(LDKScore), "LDKScore"); + *ret_ret = (this_arg_conv->lock)(this_arg_conv->this_arg); + return (uint64_t)ret_ret; +} + typedef struct LDKChannelManagerPersister_JCalls { atomic_size_t refcnt; uint32_t persist_manager_meth; @@ -7567,7 +7802,9 @@ typedef struct LDKPayer_JCalls { uint32_t node_id_meth; uint32_t first_hops_meth; uint32_t send_payment_meth; + uint32_t send_spontaneous_payment_meth; uint32_t retry_payment_meth; + uint32_t abandon_payment_meth; } LDKPayer_JCalls; static void LDKPayer_JCalls_free(void* this_arg) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; @@ -7575,7 +7812,9 @@ static void LDKPayer_JCalls_free(void* this_arg) { js_free(j_calls->node_id_meth); js_free(j_calls->first_hops_meth); js_free(j_calls->send_payment_meth); + js_free(j_calls->send_spontaneous_payment_meth); js_free(j_calls->retry_payment_meth); + js_free(j_calls->abandon_payment_meth); FREE(j_calls); } } @@ -7630,6 +7869,27 @@ LDKCResult_PaymentIdPaymentSendFailureZ send_payment_LDKPayer_jcall(const void* FREE((void*)ret); return ret_conv; } +LDKCResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_preimage) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + LDKRoute route_var = *route; + uint64_t route_ref = 0; + route_var = Route_clone(route); + CHECK((((uint64_t)route_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&route_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_var); + route_ref = (uint64_t)route_var.inner; + if (route_var.is_owned) { + route_ref |= 1; + } + int8_tArray payment_preimage_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_preimage_arr + 4), payment_preimage.data, 32); + uint32_t ret = js_invoke_function_2(j_calls->send_spontaneous_payment_meth, route_ref, payment_preimage_arr); + void* ret_ptr = (void*)(((uint64_t)ret) & ~1); + CHECK_ACCESS(ret_ptr); + LDKCResult_PaymentIdPaymentSendFailureZ ret_conv = *(LDKCResult_PaymentIdPaymentSendFailureZ*)(ret_ptr); + FREE((void*)ret); + return ret_conv; +} LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this_arg, const LDKRoute * route, LDKThirtyTwoBytes payment_id) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; LDKRoute route_var = *route; @@ -7651,6 +7911,12 @@ LDKCResult_NonePaymentSendFailureZ retry_payment_LDKPayer_jcall(const void* this FREE((void*)ret); return ret_conv; } +void abandon_payment_LDKPayer_jcall(const void* this_arg, LDKThirtyTwoBytes payment_id) { + LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) this_arg; + int8_tArray payment_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_id_arr + 4), payment_id.data, 32); + js_invoke_function_1(j_calls->abandon_payment_meth, payment_id_arr); +} static void LDKPayer_JCalls_cloned(LDKPayer* new_obj) { LDKPayer_JCalls *j_calls = (LDKPayer_JCalls*) new_obj->this_arg; atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release); @@ -7665,7 +7931,9 @@ static inline LDKPayer LDKPayer_init (/*TODO: JS Object Reference */void* o) { .node_id = node_id_LDKPayer_jcall, .first_hops = first_hops_LDKPayer_jcall, .send_payment = send_payment_LDKPayer_jcall, + .send_spontaneous_payment = send_spontaneous_payment_LDKPayer_jcall, .retry_payment = retry_payment_LDKPayer_jcall, + .abandon_payment = abandon_payment_LDKPayer_jcall, .free = LDKPayer_JCalls_free, }; return ret; @@ -7728,6 +7996,22 @@ uint32_t __attribute__((visibility("default"))) TS_Payer_send_payment(uint32_t return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_Payer_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKRoute route_conv; + route_conv.inner = (void*)(route & (~1)); + route_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(route_conv); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK(*((uint32_t*)payment_preimage) == 32); + memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); + LDKCResult_PaymentIdPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentSendFailureZ), "LDKCResult_PaymentIdPaymentSendFailureZ"); + *ret_conv = (this_arg_conv->send_spontaneous_payment)(this_arg_conv->this_arg, &route_conv, payment_preimage_ref); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_id) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } @@ -7744,6 +8028,16 @@ uint32_t __attribute__((visibility("default"))) TS_Payer_retry_payment(uint32_t return (uint64_t)ret_conv; } +void __attribute__((visibility("default"))) TS_Payer_abandon_payment(uint32_t this_arg, int8_tArray payment_id) { + void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); + if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } + LDKPayer* this_arg_conv = (LDKPayer*)this_arg_ptr; + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + (this_arg_conv->abandon_payment)(this_arg_conv->this_arg, payment_id_ref); +} + typedef struct LDKRouter_JCalls { atomic_size_t refcnt; uint32_t find_route_meth; @@ -7755,7 +8049,7 @@ static void LDKRouter_JCalls_free(void* this_arg) { FREE(j_calls); } } -LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { +LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, LDKPublicKey payer, const LDKRouteParameters * params, const uint8_t (* payment_hash)[32], LDKCVec_ChannelDetailsZ * first_hops, const LDKScore * scorer) { LDKRouter_JCalls *j_calls = (LDKRouter_JCalls*) this_arg; int8_tArray payer_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(payer_arr + 4), payer.compressed_form, 33); @@ -7769,6 +8063,8 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, if (params_var.is_owned) { params_ref |= 1; } + int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(payment_hash_arr + 4), *payment_hash, 32); LDKCVec_ChannelDetailsZ *first_hops_var_ptr = first_hops; uint32_tArray first_hops_arr = NULL; if (first_hops != NULL) { @@ -7791,7 +8087,7 @@ LDKCResult_RouteLightningErrorZ find_route_LDKRouter_jcall(const void* this_arg, } // WARNING: This object doesn't live past this scope, needs clone! uint64_t ret_scorer = ((uint64_t)scorer) | 1; - uint32_t ret = js_invoke_function_4(j_calls->find_route_meth, payer_arr, params_ref, first_hops_arr, ret_scorer); + uint32_t ret = js_invoke_function_5(j_calls->find_route_meth, payer_arr, params_ref, payment_hash_arr, first_hops_arr, ret_scorer); void* ret_ptr = (void*)(((uint64_t)ret) & ~1); CHECK_ACCESS(ret_ptr); LDKCResult_RouteLightningErrorZ ret_conv = *(LDKCResult_RouteLightningErrorZ*)(ret_ptr); @@ -7819,7 +8115,7 @@ long __attribute__((visibility("default"))) TS_LDKRouter_new(/*TODO: JS Object *res_ptr = LDKRouter_init(o); return (long)res_ptr; } -uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, uint32_tArray first_hops, uint32_t scorer) { +uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t this_arg, int8_tArray payer, uint32_t params, int8_tArray payment_hash, uint32_tArray first_hops, uint32_t scorer) { void* this_arg_ptr = (void*)(((uint64_t)this_arg) & ~1); if (!(this_arg & 1)) { CHECK_ACCESS(this_arg_ptr); } LDKRouter* this_arg_conv = (LDKRouter*)this_arg_ptr; @@ -7830,6 +8126,10 @@ uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t t params_conv.inner = (void*)(params & (~1)); params_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(params_conv); + unsigned char payment_hash_arr[32]; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_arr, (uint8_t*)(payment_hash + 4), 32); + unsigned char (*payment_hash_ref)[32] = &payment_hash_arr; LDKCVec_ChannelDetailsZ first_hops_constr; LDKCVec_ChannelDetailsZ *first_hops_ptr = NULL; if (first_hops != 0) { @@ -7853,7 +8153,7 @@ uint32_t __attribute__((visibility("default"))) TS_Router_find_route(uint32_t t if (!(scorer & 1)) { CHECK_ACCESS(scorer_ptr); } LDKScore* scorer_conv = (LDKScore*)scorer_ptr; LDKCResult_RouteLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ"); - *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, first_hops_ptr, scorer_conv); + *ret_conv = (this_arg_conv->find_route)(this_arg_conv->this_arg, payer_ref, ¶ms_conv, payment_hash_ref, first_hops_ptr, scorer_conv); if (first_hops_ptr != NULL) { FREE(first_hops_constr.data); } return (uint64_t)ret_conv; } @@ -8262,6 +8562,21 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCOutputInCommitme return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_some() { + uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_some()); + return ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_COption_NoneZ_none() { + uint32_t ret_conv = LDKCOption_NoneZ_to_js(COption_NoneZ_none()); + return ret_conv; +} + +void __attribute__((visibility("default"))) TS_COption_NoneZ_free(uint32_t _res) { + LDKCOption_NoneZ _res_conv = LDKCOption_NoneZ_from_js(_res); + COption_NoneZ_free(_res_conv); +} + uint32_t __attribute__((visibility("default"))) TS_CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(uint32_t o) { LDKCounterpartyChannelTransactionParameters o_conv; o_conv.inner = (void*)(o & (~1)); @@ -9892,78 +10207,115 @@ void __attribute__((visibility("default"))) TS_CVec_MessageSendEventZ_free(uint CVec_MessageSendEventZ_free(_res_constr); } -uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) { - LDKInitFeatures o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) { + LDKScoringParameters o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InitFeatures_clone(&o_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScoringParameters + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); + *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InitFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScoringParametersDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) { - LDKNodeFeatures o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) { + LDKScorer o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = NodeFeatures_clone(&o_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); + // Warning: we need a move here but no clone is available for LDKScorer + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); - *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); + *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); + CResult_ScorerDecodeErrorZ_free(_res_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKInitFeatures o_conv; + o_conv.inner = (void*)(o & (~1)); + o_conv.is_owned = (o & 1) || (o == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); + o_conv = InitFeatures_clone(&o_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_err(uint32_t e) { + LDKDecodeError e_conv; + e_conv.inner = (void*)(e & (~1)); + e_conv.is_owned = (e & 1) || (e == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); + e_conv = DecodeError_clone(&e_conv); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = CResult_InitFeaturesDecodeErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_InitFeaturesDecodeErrorZ* o_conv = (LDKCResult_InitFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InitFeaturesDecodeErrorZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_InitFeaturesDecodeErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_InitFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InitFeaturesDecodeErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_InitFeaturesDecodeErrorZ_free(_res_conv); } uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErrorZ_ok(uint32_t o) { @@ -10003,115 +10355,115 @@ void __attribute__((visibility("default"))) TS_CResult_ChannelFeaturesDecodeErr CResult_ChannelFeaturesDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) { - LDKInvoiceFeatures o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKNodeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - o_conv = InvoiceFeatures_clone(&o_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); + o_conv = NodeFeatures_clone(&o_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); + LDKCResult_NodeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NodeFeaturesDecodeErrorZ), "LDKCResult_NodeFeaturesDecodeErrorZ"); + *ret_conv = CResult_NodeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_NodeFeaturesDecodeErrorZ* o_conv = (LDKCResult_NodeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_NodeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_NodeFeaturesDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); + LDKCResult_NodeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_NodeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); + CResult_NodeFeaturesDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_ok(uint32_t o) { - LDKScoringParameters o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKInvoiceFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScoringParameters - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_ok(o_conv); + o_conv = InvoiceFeatures_clone(&o_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScoringParametersDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScoringParametersDecodeErrorZ), "LDKCResult_ScoringParametersDecodeErrorZ"); - *ret_conv = CResult_ScoringParametersDecodeErrorZ_err(e_conv); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = CResult_InvoiceFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_ScoringParametersDecodeErrorZ* o_conv = (LDKCResult_ScoringParametersDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScoringParametersDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_InvoiceFeaturesDecodeErrorZ* o_conv = (LDKCResult_InvoiceFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_ScoringParametersDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_InvoiceFeaturesDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScoringParametersDecodeErrorZ _res_conv = *(LDKCResult_ScoringParametersDecodeErrorZ*)(_res_ptr); + LDKCResult_InvoiceFeaturesDecodeErrorZ _res_conv = *(LDKCResult_InvoiceFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScoringParametersDecodeErrorZ_free(_res_conv); + CResult_InvoiceFeaturesDecodeErrorZ_free(_res_conv); } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_ok(uint32_t o) { - LDKScorer o_conv; +uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_ok(uint32_t o) { + LDKChannelTypeFeatures o_conv; o_conv.inner = (void*)(o & (~1)); o_conv.is_owned = (o & 1) || (o == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(o_conv); - // Warning: we need a move here but no clone is available for LDKScorer - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_ok(o_conv); + o_conv = ChannelTypeFeatures_clone(&o_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o_conv); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_err(uint32_t e) { +uint32_t __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_err(uint32_t e) { LDKDecodeError e_conv; e_conv.inner = (void*)(e & (~1)); e_conv.is_owned = (e & 1) || (e == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); e_conv = DecodeError_clone(&e_conv); - LDKCResult_ScorerDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ScorerDecodeErrorZ), "LDKCResult_ScorerDecodeErrorZ"); - *ret_conv = CResult_ScorerDecodeErrorZ_err(e_conv); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = CResult_ChannelTypeFeaturesDecodeErrorZ_err(e_conv); return (uint64_t)ret_conv; } -jboolean __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_is_ok(uint32_t o) { - LDKCResult_ScorerDecodeErrorZ* o_conv = (LDKCResult_ScorerDecodeErrorZ*)(o & ~1); - jboolean ret_val = CResult_ScorerDecodeErrorZ_is_ok(o_conv); +jboolean __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(uint32_t o) { + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* o_conv = (LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(o & ~1); + jboolean ret_val = CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o_conv); return ret_val; } -void __attribute__((visibility("default"))) TS_CResult_ScorerDecodeErrorZ_free(uint32_t _res) { +void __attribute__((visibility("default"))) TS_CResult_ChannelTypeFeaturesDecodeErrorZ_free(uint32_t _res) { if ((_res & 1) != 0) return; void* _res_ptr = (void*)(((uint64_t)_res) & ~1); CHECK_ACCESS(_res_ptr); - LDKCResult_ScorerDecodeErrorZ _res_conv = *(LDKCResult_ScorerDecodeErrorZ*)(_res_ptr); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res_conv = *(LDKCResult_ChannelTypeFeaturesDecodeErrorZ*)(_res_ptr); FREE((void*)_res); - CResult_ScorerDecodeErrorZ_free(_res_conv); + CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res_conv); } uint32_t __attribute__((visibility("default"))) TS_CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(uint32_t o) { @@ -11336,6 +11688,156 @@ void __attribute__((visibility("default"))) TS_C2Tuple_PaymentHashPaymentSecret C2Tuple_PaymentHashPaymentSecretZ_free(_res_conv); } +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(uint32_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err() { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(uint32_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(uint32_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(uint32_t o) { + void* o_ptr = (void*)(((uint64_t)o) & ~1); + CHECK_ACCESS(o_ptr); + LDKC2Tuple_PaymentHashPaymentSecretZ o_conv = *(LDKC2Tuple_PaymentHashPaymentSecretZ*)(o_ptr); + o_conv = C2Tuple_PaymentHashPaymentSecretZ_clone((LDKC2Tuple_PaymentHashPaymentSecretZ*)(((uint64_t)o) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(uint32_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(uint32_t o) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* o_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res_conv = *(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(uint32_t arg) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* arg_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(uint32_t orig) { + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* orig_conv = (LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ*)(orig & ~1); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(*((uint32_t*)o) == 32); + memcpy(o_ref.data, (uint8_t*)(o + 4), 32); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_err() { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_err(); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_is_ok(uint32_t o) { + LDKCResult_PaymentSecretNoneZ* o_conv = (LDKCResult_PaymentSecretNoneZ*)(o & ~1); + jboolean ret_val = CResult_PaymentSecretNoneZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentSecretNoneZ _res_conv = *(LDKCResult_PaymentSecretNoneZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentSecretNoneZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg) { + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone_ptr(uint32_t arg) { + LDKCResult_PaymentSecretNoneZ* arg_conv = (LDKCResult_PaymentSecretNoneZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentSecretNoneZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretNoneZ_clone(uint32_t orig) { + LDKCResult_PaymentSecretNoneZ* orig_conv = (LDKCResult_PaymentSecretNoneZ*)(orig & ~1); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = CResult_PaymentSecretNoneZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_ok(int8_tArray o) { LDKThirtyTwoBytes o_ref; CHECK(*((uint32_t*)o) == 32); @@ -11388,6 +11890,58 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErro return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_ok(int8_tArray o) { + LDKThirtyTwoBytes o_ref; + CHECK(*((uint32_t*)o) == 32); + memcpy(o_ref.data, (uint8_t*)(o + 4), 32); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_ok(o_ref); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_err(uint32_t e) { + void* e_ptr = (void*)(((uint64_t)e) & ~1); + CHECK_ACCESS(e_ptr); + LDKAPIError e_conv = *(LDKAPIError*)(e_ptr); + e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1)); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_err(e_conv); + return (uint64_t)ret_conv; +} + +jboolean __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_is_ok(uint32_t o) { + LDKCResult_PaymentPreimageAPIErrorZ* o_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(o & ~1); + jboolean ret_val = CResult_PaymentPreimageAPIErrorZ_is_ok(o_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_free(uint32_t _res) { + if ((_res & 1) != 0) return; + void* _res_ptr = (void*)(((uint64_t)_res) & ~1); + CHECK_ACCESS(_res_ptr); + LDKCResult_PaymentPreimageAPIErrorZ _res_conv = *(LDKCResult_PaymentPreimageAPIErrorZ*)(_res_ptr); + FREE((void*)_res); + CResult_PaymentPreimageAPIErrorZ_free(_res_conv); +} + +static inline uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg) { + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(arg); + return (uint64_t)ret_conv; +} +int64_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone_ptr(uint32_t arg) { + LDKCResult_PaymentPreimageAPIErrorZ* arg_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(arg & ~1); + int64_t ret_val = CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentPreimageAPIErrorZ_clone(uint32_t orig) { + LDKCResult_PaymentPreimageAPIErrorZ* orig_conv = (LDKCResult_PaymentPreimageAPIErrorZ*)(orig & ~1); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = CResult_PaymentPreimageAPIErrorZ_clone(orig_conv); + return (uint64_t)ret_conv; +} + void __attribute__((visibility("default"))) TS_CVec_ChannelMonitorZ_free(uint32_tArray _res) { LDKCVec_ChannelMonitorZ _res_constr; _res_constr.datalen = *((uint32_t*)_res); @@ -12531,56 +13085,6 @@ uint32_t __attribute__((visibility("default"))) TS_CResult_HTLCUpdateDecodeErro return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_ok() { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_ok(); - return (uint64_t)ret_conv; -} - -uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_err(uint32_t e) { - LDKMonitorUpdateError e_conv; - e_conv.inner = (void*)(e & (~1)); - e_conv.is_owned = (e & 1) || (e == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(e_conv); - e_conv = MonitorUpdateError_clone(&e_conv); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_err(e_conv); - return (uint64_t)ret_conv; -} - -jboolean __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_is_ok(uint32_t o) { - LDKCResult_NoneMonitorUpdateErrorZ* o_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(o & ~1); - jboolean ret_val = CResult_NoneMonitorUpdateErrorZ_is_ok(o_conv); - return ret_val; -} - -void __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_free(uint32_t _res) { - if ((_res & 1) != 0) return; - void* _res_ptr = (void*)(((uint64_t)_res) & ~1); - CHECK_ACCESS(_res_ptr); - LDKCResult_NoneMonitorUpdateErrorZ _res_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)(_res_ptr); - FREE((void*)_res); - CResult_NoneMonitorUpdateErrorZ_free(_res_conv); -} - -static inline uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg) { - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(arg); - return (uint64_t)ret_conv; -} -int64_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone_ptr(uint32_t arg) { - LDKCResult_NoneMonitorUpdateErrorZ* arg_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(arg & ~1); - int64_t ret_val = CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg_conv); - return ret_val; -} - -uint32_t __attribute__((visibility("default"))) TS_CResult_NoneMonitorUpdateErrorZ_clone(uint32_t orig) { - LDKCResult_NoneMonitorUpdateErrorZ* orig_conv = (LDKCResult_NoneMonitorUpdateErrorZ*)(orig & ~1); - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); - *ret_conv = CResult_NoneMonitorUpdateErrorZ_clone(orig_conv); - return (uint64_t)ret_conv; -} - static inline uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg) { LDKC2Tuple_OutPointScriptZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ"); *ret_conv = C2Tuple_OutPointScriptZ_clone(arg); @@ -15991,7 +16495,7 @@ uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_clone(uint32_ return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret, int64_t user_payment_id) { +uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payment(int8_tArray payment_preimage, int8_tArray payment_secret) { LDKThirtyTwoBytes payment_preimage_ref; CHECK(*((uint32_t*)payment_preimage) == 32); memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); @@ -15999,7 +16503,7 @@ uint32_t __attribute__((visibility("default"))) TS_PaymentPurpose_invoice_payme CHECK(*((uint32_t*)payment_secret) == 32); memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32); LDKPaymentPurpose *ret_copy = MALLOC(sizeof(LDKPaymentPurpose), "LDKPaymentPurpose"); - *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref, user_payment_id); + *ret_copy = PaymentPurpose_invoice_payment(payment_preimage_ref, payment_secret_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -16072,6 +16576,13 @@ uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_ return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_ClosureReason_funding_timed_out() { + LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); + *ret_copy = ClosureReason_funding_timed_out(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) { LDKStr err_conv = str_ref_to_owned_c(err); LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason"); @@ -16231,6 +16742,19 @@ uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(in return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_id, int8_tArray payment_hash) { + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_failed(payment_id_ref, payment_hash_ref); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_Event_pending_htlcs_forwardable(int64_t time_forwardable) { LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); *ret_copy = Event_pending_htlcs_forwardable(time_forwardable); @@ -16300,6 +16824,35 @@ uint32_t __attribute__((visibility("default"))) TS_Event_discard_funding(int8_t return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_successful(int8_tArray payment_id, int8_tArray payment_hash, uint32_tArray path) { + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + LDKCVec_RouteHopZ path_constr; + path_constr.datalen = *((uint32_t*)path); + if (path_constr.datalen > 0) + path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements"); + else + path_constr.data = NULL; + uint32_t* path_vals = (uint32_t*)(path + 4); + for (size_t k = 0; k < path_constr.datalen; k++) { + uint32_t path_conv_10 = path_vals[k]; + LDKRouteHop path_conv_10_conv; + path_conv_10_conv.inner = (void*)(path_conv_10 & (~1)); + path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(path_conv_10_conv); + path_conv_10_conv = RouteHop_clone(&path_conv_10_conv); + path_constr.data[k] = path_conv_10_conv; + } + LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent"); + *ret_copy = Event_payment_path_successful(payment_id_ref, payment_hash_ref, path_constr); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) { LDKEvent* obj_conv = (LDKEvent*)obj; LDKCVec_u8Z ret_var = Event_write(obj_conv); @@ -16775,6 +17328,11 @@ uint32_t __attribute__((visibility("default"))) TS_Level_clone(uint32_t orig) { return ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_Level_gossip() { + uint32_t ret_conv = LDKLevel_to_js(Level_gossip()); + return ret_conv; +} + uint32_t __attribute__((visibility("default"))) TS_Level_trace() { uint32_t ret_conv = LDKLevel_to_js(Level_trace()); return ret_conv; @@ -17626,7 +18184,24 @@ void __attribute__((visibility("default"))) TS_UserConfig_set_accept_forwards_t UserConfig_set_accept_forwards_to_priv_channels(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg) { +jboolean __attribute__((visibility("default"))) TS_UserConfig_get_accept_inbound_channels(uint32_t this_ptr) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + jboolean ret_val = UserConfig_get_accept_inbound_channels(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_UserConfig_set_accept_inbound_channels(uint32_t this_ptr, jboolean val) { + LDKUserConfig this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + UserConfig_set_accept_inbound_channels(&this_ptr_conv, val); +} + +uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_channel_config_arg, uint32_t peer_channel_config_limits_arg, uint32_t channel_options_arg, jboolean accept_forwards_to_priv_channels_arg, jboolean accept_inbound_channels_arg) { LDKChannelHandshakeConfig own_channel_config_arg_conv; own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1)); own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0); @@ -17642,7 +18217,7 @@ uint32_t __attribute__((visibility("default"))) TS_UserConfig_new(uint32_t own_ channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(channel_options_arg_conv); channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv); - LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg); + LDKUserConfig ret_var = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -18423,86 +18998,6 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_read(in return (uint64_t)ret_conv; } -void __attribute__((visibility("default"))) TS_MonitorUpdateError_free(uint32_t this_obj) { - LDKMonitorUpdateError this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - MonitorUpdateError_free(this_obj_conv); -} - -jstring __attribute__((visibility("default"))) TS_MonitorUpdateError_get_a(uint32_t this_ptr) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr ret_str = MonitorUpdateError_get_a(&this_ptr_conv); - jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len); - Str_free(ret_str); - return ret_conv; -} - -void __attribute__((visibility("default"))) TS_MonitorUpdateError_set_a(uint32_t this_ptr, jstring val) { - LDKMonitorUpdateError this_ptr_conv; - this_ptr_conv.inner = (void*)(this_ptr & (~1)); - this_ptr_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); - LDKStr val_conv = str_ref_to_owned_c(val); - MonitorUpdateError_set_a(&this_ptr_conv, val_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_new(jstring a_arg) { - LDKStr a_arg_conv = str_ref_to_owned_c(a_arg); - LDKMonitorUpdateError ret_var = MonitorUpdateError_new(a_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -static inline uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg) { - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(arg); -uint64_t ret_ref = 0; -CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. -CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. -CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); -ret_ref = (uint64_t)ret_var.inner; -if (ret_var.is_owned) { - ret_ref |= 1; -} - return ret_ref; -} -int64_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone_ptr(uint32_t arg) { - LDKMonitorUpdateError arg_conv; - arg_conv.inner = (void*)(arg & (~1)); - arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); - int64_t ret_val = MonitorUpdateError_clone_ptr(&arg_conv); - return ret_val; -} - -uint32_t __attribute__((visibility("default"))) TS_MonitorUpdateError_clone(uint32_t orig) { - LDKMonitorUpdateError orig_conv; - orig_conv.inner = (void*)(orig & (~1)); - orig_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); - LDKMonitorUpdateError ret_var = MonitorUpdateError_clone(&orig_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - void __attribute__((visibility("default"))) TS_MonitorEvent_free(uint32_t this_ptr) { if ((this_ptr & 1) != 0) return; void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); @@ -18805,7 +19300,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelMonitor_update_monito void* logger_ptr = (void*)(((uint64_t)logger) & ~1); if (!(logger & 1)) { CHECK_ACCESS(logger_ptr); } LDKLogger* logger_conv = (LDKLogger*)logger_ptr; - LDKCResult_NoneMonitorUpdateErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ"); + LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ"); *ret_conv = ChannelMonitor_update_monitor(&this_arg_conv, &updates_conv, broadcaster_conv, fee_estimator_conv, logger_conv); return (uint64_t)ret_conv; } @@ -20141,6 +20636,15 @@ uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_get_channel_p return ret_ref; } +jboolean __attribute__((visibility("default"))) TS_InMemorySigner_opt_anchors(uint32_t this_arg) { + LDKInMemorySigner this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = InMemorySigner_opt_anchors(&this_arg_conv); + return ret_val; +} + uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_sign_counterparty_payment_input(uint32_t this_arg, int8_tArray spend_tx, int64_t input_idx, uint32_t descriptor) { LDKInMemorySigner this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -20894,6 +21398,23 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_user_channel_ ChannelDetails_set_user_channel_id(&this_ptr_conv, val); } +int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_balance_msat(uint32_t this_ptr) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ChannelDetails_get_balance_msat(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ChannelDetails_set_balance_msat(uint32_t this_ptr, int64_t val) { + LDKChannelDetails this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ChannelDetails_set_balance_msat(&this_ptr_conv, val); +} + int64_t __attribute__((visibility("default"))) TS_ChannelDetails_get_outbound_capacity_msat(uint32_t this_ptr) { LDKChannelDetails this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -21042,7 +21563,7 @@ void __attribute__((visibility("default"))) TS_ChannelDetails_set_is_public(uin ChannelDetails_set_is_public(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { +uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArray channel_id_arg, uint32_t counterparty_arg, uint32_t funding_txo_arg, uint32_t short_channel_id_arg, int64_t channel_value_satoshis_arg, uint32_t unspendable_punishment_reserve_arg, int64_t user_channel_id_arg, int64_t balance_msat_arg, int64_t outbound_capacity_msat_arg, int64_t inbound_capacity_msat_arg, uint32_t confirmations_required_arg, uint32_t force_close_spend_delay_arg, jboolean is_outbound_arg, jboolean is_funding_locked_arg, jboolean is_usable_arg, jboolean is_public_arg) { LDKThirtyTwoBytes channel_id_arg_ref; CHECK(*((uint32_t*)channel_id_arg) == 32); memcpy(channel_id_arg_ref.data, (uint8_t*)(channel_id_arg + 4), 32); @@ -21071,7 +21592,7 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelDetails_new(int8_tArr CHECK_ACCESS(force_close_spend_delay_arg_ptr); LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(force_close_spend_delay_arg_ptr); force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1)); - LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -21446,6 +21967,17 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_retry_payment return (uint64_t)ret_conv; } +void __attribute__((visibility("default"))) TS_ChannelManager_abandon_payment(uint32_t this_arg, int8_tArray payment_id) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_id_ref; + CHECK(*((uint32_t*)payment_id) == 32); + memcpy(payment_id_ref.data, (uint8_t*)(payment_id + 4), 32); + ChannelManager_abandon_payment(&this_arg_conv, payment_id_ref); +} + uint32_t __attribute__((visibility("default"))) TS_ChannelManager_send_spontaneous_payment(uint32_t this_arg, uint32_t route, int8_tArray payment_preimage) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -21561,7 +22093,7 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_get_our_no return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -21570,12 +22102,43 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inboun CHECK_ACCESS(min_value_msat_ptr); LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); - LDKC2Tuple_PaymentHashPaymentSecretZ* ret_conv = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ"); - *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); - return ((uint64_t)ret_conv); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_legacy(uint32_t this_arg, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ), "LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ"); + *ret_conv = ChannelManager_create_inbound_payment_legacy(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + void* min_value_msat_ptr = (void*)(((uint64_t)min_value_msat) & ~1); + CHECK_ACCESS(min_value_msat_ptr); + LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); + min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); + LDKCResult_PaymentSecretNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretNoneZ), "LDKCResult_PaymentSecretNoneZ"); + *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs, int64_t user_payment_id) { +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inbound_payment_for_hash_legacy(uint32_t this_arg, int8_tArray payment_hash, uint32_t min_value_msat, int32_t invoice_expiry_delta_secs) { LDKChannelManager this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; @@ -21588,7 +22151,23 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelManager_create_inboun LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(min_value_msat_ptr); min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1)); LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ"); - *ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id); + *ret_conv = ChannelManager_create_inbound_payment_for_hash_legacy(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs); + return (uint64_t)ret_conv; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelManager_get_payment_preimage(uint32_t this_arg, int8_tArray payment_hash, int8_tArray payment_secret) { + LDKChannelManager this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKThirtyTwoBytes payment_hash_ref; + CHECK(*((uint32_t*)payment_hash) == 32); + memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32); + LDKThirtyTwoBytes payment_secret_ref; + CHECK(*((uint32_t*)payment_secret) == 32); + memcpy(payment_secret_ref.data, (uint8_t*)(payment_secret + 4), 32); + LDKCResult_PaymentPreimageAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentPreimageAPIErrorZ), "LDKCResult_PaymentPreimageAPIErrorZ"); + *ret_conv = ChannelManager_get_payment_preimage(&this_arg_conv, payment_hash_ref, payment_secret_ref); return (uint64_t)ret_conv; } @@ -22652,6 +23231,38 @@ void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_flags(ui OpenChannel_set_channel_flags(&this_ptr_conv, val); } +uint32_t __attribute__((visibility("default"))) TS_OpenChannel_get_channel_type(uint32_t this_ptr) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures ret_var = OpenChannel_get_channel_type(&this_ptr_conv); + uint64_t ret_ref = 0; + if ((uint64_t)ret_var.inner > 4096) { + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + } + return ret_ref; +} + +void __attribute__((visibility("default"))) TS_OpenChannel_set_channel_type(uint32_t this_ptr, uint32_t val) { + LDKOpenChannel this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKChannelTypeFeatures val_conv; + val_conv.inner = (void*)(val & (~1)); + val_conv.is_owned = (val & 1) || (val == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(val_conv); + val_conv = ChannelTypeFeatures_clone(&val_conv); + OpenChannel_set_channel_type(&this_ptr_conv, val_conv); +} + static inline uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg) { LDKOpenChannel ret_var = OpenChannel_clone(arg); uint64_t ret_ref = 0; @@ -24955,12 +25566,12 @@ uint32_t __attribute__((visibility("default"))) TS_NetAddress_ipv6(int8_tArray return ret_ref; } -uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray addr, int16_t port) { - LDKTenBytes addr_ref; - CHECK(*((uint32_t*)addr) == 10); - memcpy(addr_ref.data, (uint8_t*)(addr + 4), 10); +uint32_t __attribute__((visibility("default"))) TS_NetAddress_onion_v2(int8_tArray a) { + LDKTwelveBytes a_ref; + CHECK(*((uint32_t*)a) == 12); + memcpy(a_ref.data, (uint8_t*)(a + 4), 12); LDKNetAddress *ret_copy = MALLOC(sizeof(LDKNetAddress), "LDKNetAddress"); - *ret_copy = NetAddress_onion_v2(addr_ref, port); + *ret_copy = NetAddress_onion_v2(a_ref); uint64_t ret_ref = (uint64_t)ret_copy; return ret_ref; } @@ -26649,6 +27260,13 @@ uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_and_log(u return ret_ref; } +uint32_t __attribute__((visibility("default"))) TS_ErrorAction_ignore_duplicate_gossip() { + LDKErrorAction *ret_copy = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction"); + *ret_copy = ErrorAction_ignore_duplicate_gossip(); + uint64_t ret_ref = (uint64_t)ret_copy; + return ret_ref; +} + uint32_t __attribute__((visibility("default"))) TS_ErrorAction_send_error_message(uint32_t msg) { LDKErrorMessage msg_conv; msg_conv.inner = (void*)(msg & (~1)); @@ -28311,6 +28929,16 @@ void __attribute__((visibility("default"))) TS_PeerManager_timer_tick_occurred( PeerManager_timer_tick_occurred(&this_arg_conv); } +int64_t __attribute__((visibility("default"))) TS_htlc_success_tx_weight(jboolean opt_anchors) { + int64_t ret_val = htlc_success_tx_weight(opt_anchors); + return ret_val; +} + +int64_t __attribute__((visibility("default"))) TS_htlc_timeout_tx_weight(jboolean opt_anchors) { + int64_t ret_val = htlc_timeout_tx_weight(opt_anchors); + return ret_val; +} + int8_tArray __attribute__((visibility("default"))) TS_build_commitment_secret(int8_tArray commitment_seed, int64_t idx) { unsigned char commitment_seed_arr[32]; CHECK(*((uint32_t*)commitment_seed) == 32); @@ -29027,7 +29655,7 @@ uint32_t __attribute__((visibility("default"))) TS_HTLCOutputInCommitment_read( return (uint64_t)ret_conv; } -int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, uint32_t keys) { +int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uint32_t htlc, jboolean opt_anchors, uint32_t keys) { LDKHTLCOutputInCommitment htlc_conv; htlc_conv.inner = (void*)(htlc & (~1)); htlc_conv.is_owned = false; @@ -29036,7 +29664,7 @@ int8_tArray __attribute__((visibility("default"))) TS_get_htlc_redeemscript(uin keys_conv.inner = (void*)(keys & (~1)); keys_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(keys_conv); - LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, &keys_conv); + LDKCVec_u8Z ret_var = get_htlc_redeemscript(&htlc_conv, opt_anchors, &keys_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); @@ -29057,7 +29685,7 @@ int8_tArray __attribute__((visibility("default"))) TS_make_funding_redeemscript return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { +int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(int8_tArray commitment_txid, int32_t feerate_per_kw, int16_t contest_delay, uint32_t htlc, jboolean opt_anchors, int8_tArray broadcaster_delayed_payment_key, int8_tArray revocation_key) { unsigned char commitment_txid_arr[32]; CHECK(*((uint32_t*)commitment_txid) == 32); memcpy(commitment_txid_arr, (uint8_t*)(commitment_txid + 4), 32); @@ -29072,13 +29700,24 @@ int8_tArray __attribute__((visibility("default"))) TS_build_htlc_transaction(in LDKPublicKey revocation_key_ref; CHECK(*((uint32_t*)revocation_key) == 33); memcpy(revocation_key_ref.compressed_form, (uint8_t*)(revocation_key + 4), 33); - LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref); + LDKTransaction ret_var = build_htlc_transaction(commitment_txid_ref, feerate_per_kw, contest_delay, &htlc_conv, opt_anchors, broadcaster_delayed_payment_key_ref, revocation_key_ref); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); Transaction_free(ret_var); return ret_arr; } +int8_tArray __attribute__((visibility("default"))) TS_get_anchor_redeemscript(int8_tArray funding_pubkey) { + LDKPublicKey funding_pubkey_ref; + CHECK(*((uint32_t*)funding_pubkey) == 33); + memcpy(funding_pubkey_ref.compressed_form, (uint8_t*)(funding_pubkey + 4), 33); + LDKCVec_u8Z ret_var = get_anchor_redeemscript(funding_pubkey_ref); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_free(uint32_t this_obj) { LDKChannelTransactionParameters this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -29215,7 +29854,25 @@ void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set ChannelTransactionParameters_set_funding_outpoint(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg) { +uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_get_opt_anchors(uint32_t this_ptr) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + uint32_t ret_conv = LDKCOption_NoneZ_to_js(ChannelTransactionParameters_get_opt_anchors(&this_ptr_conv)); + return ret_conv; +} + +void __attribute__((visibility("default"))) TS_ChannelTransactionParameters_set_opt_anchors(uint32_t this_ptr, uint32_t val) { + LDKChannelTransactionParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + LDKCOption_NoneZ val_conv = LDKCOption_NoneZ_from_js(val); + ChannelTransactionParameters_set_opt_anchors(&this_ptr_conv, val_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters_new(uint32_t holder_pubkeys_arg, int16_t holder_selected_contest_delay_arg, jboolean is_outbound_from_holder_arg, uint32_t counterparty_parameters_arg, uint32_t funding_outpoint_arg, uint32_t opt_anchors_arg) { LDKChannelPublicKeys holder_pubkeys_arg_conv; holder_pubkeys_arg_conv.inner = (void*)(holder_pubkeys_arg & (~1)); holder_pubkeys_arg_conv.is_owned = (holder_pubkeys_arg & 1) || (holder_pubkeys_arg == 0); @@ -29231,7 +29888,8 @@ uint32_t __attribute__((visibility("default"))) TS_ChannelTransactionParameters funding_outpoint_arg_conv.is_owned = (funding_outpoint_arg & 1) || (funding_outpoint_arg == 0); CHECK_INNER_FIELD_ACCESS_OR_NULL(funding_outpoint_arg_conv); funding_outpoint_arg_conv = OutPoint_clone(&funding_outpoint_arg_conv); - LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv); + LDKCOption_NoneZ opt_anchors_arg_conv = LDKCOption_NoneZ_from_js(opt_anchors_arg); + LDKChannelTransactionParameters ret_var = ChannelTransactionParameters_new(holder_pubkeys_arg_conv, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg_conv, funding_outpoint_arg_conv, opt_anchors_arg_conv); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -29554,6 +30212,15 @@ uint32_t __attribute__((visibility("default"))) TS_DirectedChannelTransactionPa return ret_ref; } +jboolean __attribute__((visibility("default"))) TS_DirectedChannelTransactionParameters_opt_anchors(uint32_t this_arg) { + LDKDirectedChannelTransactionParameters this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = DirectedChannelTransactionParameters_opt_anchors(&this_arg_conv); + return ret_val; +} + void __attribute__((visibility("default"))) TS_HolderCommitmentTransaction_free(uint32_t this_obj) { LDKHolderCommitmentTransaction this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -30266,6 +30933,15 @@ uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction return ret_ref; } +jboolean __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_opt_anchors(uint32_t this_arg) { + LDKTrustedCommitmentTransaction this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + jboolean ret_val = TrustedCommitmentTransaction_opt_anchors(&this_arg_conv); + return ret_val; +} + uint32_t __attribute__((visibility("default"))) TS_TrustedCommitmentTransaction_get_htlc_sigs(uint32_t this_arg, int8_tArray htlc_base_key, uint32_t channel_parameters) { LDKTrustedCommitmentTransaction this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -30347,6 +31023,19 @@ jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_eq(uint32_t return ret_val; } +jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_eq(uint32_t a, uint32_t b) { + LDKChannelTypeFeatures a_conv; + a_conv.inner = (void*)(a & (~1)); + a_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(a_conv); + LDKChannelTypeFeatures b_conv; + b_conv.inner = (void*)(b & (~1)); + b_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(b_conv); + jboolean ret_val = ChannelTypeFeatures_eq(&a_conv, &b_conv); + return ret_val; +} + static inline uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg) { LDKInitFeatures ret_var = InitFeatures_clone(arg); uint64_t ret_ref = 0; @@ -30499,6 +31188,44 @@ uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_clone(uint32 return ret_ref; } +static inline uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg) { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(arg); +uint64_t ret_ref = 0; +CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. +CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. +CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); +ret_ref = (uint64_t)ret_var.inner; +if (ret_var.is_owned) { + ret_ref |= 1; +} + return ret_ref; +} +int64_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone_ptr(uint32_t arg) { + LDKChannelTypeFeatures arg_conv; + arg_conv.inner = (void*)(arg & (~1)); + arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(arg_conv); + int64_t ret_val = ChannelTypeFeatures_clone_ptr(&arg_conv); + return ret_val; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_clone(uint32_t orig) { + LDKChannelTypeFeatures orig_conv; + orig_conv.inner = (void*)(orig & (~1)); + orig_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(orig_conv); + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_clone(&orig_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + void __attribute__((visibility("default"))) TS_InitFeatures_free(uint32_t this_obj) { LDKInitFeatures this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -30531,6 +31258,14 @@ void __attribute__((visibility("default"))) TS_InvoiceFeatures_free(uint32_t th InvoiceFeatures_free(this_obj_conv); } +void __attribute__((visibility("default"))) TS_ChannelTypeFeatures_free(uint32_t this_obj) { + LDKChannelTypeFeatures this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + ChannelTypeFeatures_free(this_obj_conv); +} + uint32_t __attribute__((visibility("default"))) TS_InitFeatures_empty() { LDKInitFeatures ret_var = InitFeatures_empty(); uint64_t ret_ref = 0; @@ -30671,30 +31406,38 @@ jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unk return ret_val; } -jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) { - LDKInitFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InitFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_empty() { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_empty(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_NodeFeatures_supports_payment_secret(uint32_t this_arg) { - LDKNodeFeatures this_arg_conv; - this_arg_conv.inner = (void*)(this_arg & (~1)); - this_arg_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = NodeFeatures_supports_payment_secret(&this_arg_conv); - return ret_val; +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_known() { + LDKChannelTypeFeatures ret_var = ChannelTypeFeatures_known(); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; } -jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_supports_payment_secret(uint32_t this_arg) { - LDKInvoiceFeatures this_arg_conv; +jboolean __attribute__((visibility("default"))) TS_ChannelTypeFeatures_requires_unknown_bits(uint32_t this_arg) { + LDKChannelTypeFeatures this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); this_arg_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); - jboolean ret_val = InvoiceFeatures_supports_payment_secret(&this_arg_conv); + jboolean ret_val = ChannelTypeFeatures_requires_unknown_bits(&this_arg_conv); return ret_val; } @@ -30710,16 +31453,13 @@ int8_tArray __attribute__((visibility("default"))) TS_InitFeatures_write(uint32 return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) { - LDKNodeFeatures obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; +uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); + *ret_conv = InitFeatures_read(ser_ref); + return (uint64_t)ret_conv; } int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uint32_t obj) { @@ -30734,27 +31474,27 @@ int8_tArray __attribute__((visibility("default"))) TS_ChannelFeatures_write(uin return ret_arr; } -int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) { - LDKInvoiceFeatures obj_conv; +uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) { + LDKu8slice ser_ref; + ser_ref.datalen = *((uint32_t*)ser); + ser_ref.data = (int8_t*)(ser + 4); + LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); + *ret_conv = ChannelFeatures_read(ser_ref); + return (uint64_t)ret_conv; +} + +int8_tArray __attribute__((visibility("default"))) TS_NodeFeatures_write(uint32_t obj) { + LDKNodeFeatures obj_conv; obj_conv.inner = (void*)(obj & (~1)); obj_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + LDKCVec_u8Z ret_var = NodeFeatures_write(&obj_conv); int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); CVec_u8Z_free(ret_var); return ret_arr; } -uint32_t __attribute__((visibility("default"))) TS_InitFeatures_read(int8_tArray ser) { - LDKu8slice ser_ref; - ser_ref.datalen = *((uint32_t*)ser); - ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_InitFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InitFeaturesDecodeErrorZ), "LDKCResult_InitFeaturesDecodeErrorZ"); - *ret_conv = InitFeatures_read(ser_ref); - return (uint64_t)ret_conv; -} - uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); @@ -30764,21 +31504,45 @@ uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_read(int8_tArra return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_read(int8_tArray ser) { +int8_tArray __attribute__((visibility("default"))) TS_InvoiceFeatures_write(uint32_t obj) { + LDKInvoiceFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = InvoiceFeatures_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_ChannelFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ), "LDKCResult_ChannelFeaturesDecodeErrorZ"); - *ret_conv = ChannelFeatures_read(ser_ref); + LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); + *ret_conv = InvoiceFeatures_read(ser_ref); return (uint64_t)ret_conv; } -uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_read(int8_tArray ser) { +int8_tArray __attribute__((visibility("default"))) TS_ChannelTypeFeatures_write(uint32_t obj) { + LDKChannelTypeFeatures obj_conv; + obj_conv.inner = (void*)(obj & (~1)); + obj_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); + LDKCVec_u8Z ret_var = ChannelTypeFeatures_write(&obj_conv); + int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); + memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); + CVec_u8Z_free(ret_var); + return ret_arr; +} + +uint32_t __attribute__((visibility("default"))) TS_ChannelTypeFeatures_read(int8_tArray ser) { LDKu8slice ser_ref; ser_ref.datalen = *((uint32_t*)ser); ser_ref.data = (int8_t*)(ser + 4); - LDKCResult_InvoiceFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ), "LDKCResult_InvoiceFeaturesDecodeErrorZ"); - *ret_conv = InvoiceFeatures_read(ser_ref); + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ), "LDKCResult_ChannelTypeFeaturesDecodeErrorZ"); + *ret_conv = ChannelTypeFeatures_read(ser_ref); return (uint64_t)ret_conv; } @@ -31054,51 +31818,6 @@ void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) { Type_free(this_ptr_conv); } -void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) { - if ((this_ptr & 1) != 0) return; - void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); - CHECK_ACCESS(this_ptr_ptr); - LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); - FREE((void*)this_ptr); - Score_free(this_ptr_conv); -} - -void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_obj) { - LDKLockableScore this_obj_conv; - this_obj_conv.inner = (void*)(this_obj & (~1)); - this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); - LockableScore_free(this_obj_conv); -} - -uint32_t __attribute__((visibility("default"))) TS_LockableScore_new(uint32_t score) { - void* score_ptr = (void*)(((uint64_t)score) & ~1); - CHECK_ACCESS(score_ptr); - LDKScore score_conv = *(LDKScore*)(score_ptr); - LDKLockableScore ret_var = LockableScore_new(score_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - -int8_tArray __attribute__((visibility("default"))) TS_LockableScore_write(uint32_t obj) { - LDKLockableScore obj_conv; - obj_conv.inner = (void*)(obj & (~1)); - obj_conv.is_owned = false; - CHECK_INNER_FIELD_ACCESS_OR_NULL(obj_conv); - LDKCVec_u8Z ret_var = LockableScore_write(&obj_conv); - int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes"); - memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen); - CVec_u8Z_free(ret_var); - return ret_arr; -} - void __attribute__((visibility("default"))) TS_NodeId_free(uint32_t this_obj) { LDKNodeId this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -31876,53 +32595,6 @@ void __attribute__((visibility("default"))) TS_ChannelInfo_set_announcement_mes ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv); } -uint32_t __attribute__((visibility("default"))) TS_ChannelInfo_new(uint32_t features_arg, uint32_t node_one_arg, uint32_t one_to_two_arg, uint32_t node_two_arg, uint32_t two_to_one_arg, uint32_t capacity_sats_arg, uint32_t announcement_message_arg) { - LDKChannelFeatures features_arg_conv; - features_arg_conv.inner = (void*)(features_arg & (~1)); - features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(features_arg_conv); - features_arg_conv = ChannelFeatures_clone(&features_arg_conv); - LDKNodeId node_one_arg_conv; - node_one_arg_conv.inner = (void*)(node_one_arg & (~1)); - node_one_arg_conv.is_owned = (node_one_arg & 1) || (node_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_one_arg_conv); - node_one_arg_conv = NodeId_clone(&node_one_arg_conv); - LDKDirectionalChannelInfo one_to_two_arg_conv; - one_to_two_arg_conv.inner = (void*)(one_to_two_arg & (~1)); - one_to_two_arg_conv.is_owned = (one_to_two_arg & 1) || (one_to_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(one_to_two_arg_conv); - one_to_two_arg_conv = DirectionalChannelInfo_clone(&one_to_two_arg_conv); - LDKNodeId node_two_arg_conv; - node_two_arg_conv.inner = (void*)(node_two_arg & (~1)); - node_two_arg_conv.is_owned = (node_two_arg & 1) || (node_two_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(node_two_arg_conv); - node_two_arg_conv = NodeId_clone(&node_two_arg_conv); - LDKDirectionalChannelInfo two_to_one_arg_conv; - two_to_one_arg_conv.inner = (void*)(two_to_one_arg & (~1)); - two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(two_to_one_arg_conv); - two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv); - void* capacity_sats_arg_ptr = (void*)(((uint64_t)capacity_sats_arg) & ~1); - CHECK_ACCESS(capacity_sats_arg_ptr); - LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(capacity_sats_arg_ptr); - capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1)); - LDKChannelAnnouncement announcement_message_arg_conv; - announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1)); - announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0); - CHECK_INNER_FIELD_ACCESS_OR_NULL(announcement_message_arg_conv); - announcement_message_arg_conv = ChannelAnnouncement_clone(&announcement_message_arg_conv); - LDKChannelInfo ret_var = ChannelInfo_new(features_arg_conv, node_one_arg_conv, one_to_two_arg_conv, node_two_arg_conv, two_to_one_arg_conv, capacity_sats_arg_conv, announcement_message_arg_conv); - uint64_t ret_ref = 0; - CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. - CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. - CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); - ret_ref = (uint64_t)ret_var.inner; - if (ret_var.is_owned) { - ret_ref |= 1; - } - return ret_ref; -} - static inline uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg) { LDKChannelInfo ret_var = ChannelInfo_clone(arg); uint64_t ret_ref = 0; @@ -32699,6 +33371,14 @@ void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent); } +void __attribute__((visibility("default"))) TS_NetworkGraph_remove_stale_channels_with_time(uint32_t this_arg, int64_t current_time_unix) { + LDKNetworkGraph this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + NetworkGraph_remove_stale_channels_with_time(&this_arg_conv, current_time_unix); +} + uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) { LDKNetworkGraph this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); @@ -34139,6 +34819,48 @@ uint32_t __attribute__((visibility("default"))) TS_find_route(int8_tArray our_n return (uint64_t)ret_conv; } +void __attribute__((visibility("default"))) TS_Score_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKScore this_ptr_conv = *(LDKScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + Score_free(this_ptr_conv); +} + +void __attribute__((visibility("default"))) TS_LockableScore_free(uint32_t this_ptr) { + if ((this_ptr & 1) != 0) return; + void* this_ptr_ptr = (void*)(((uint64_t)this_ptr) & ~1); + CHECK_ACCESS(this_ptr_ptr); + LDKLockableScore this_ptr_conv = *(LDKLockableScore*)(this_ptr_ptr); + FREE((void*)this_ptr); + LockableScore_free(this_ptr_conv); +} + +void __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_free(uint32_t this_obj) { + LDKMultiThreadedLockableScore this_obj_conv; + this_obj_conv.inner = (void*)(this_obj & (~1)); + this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0); + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_obj_conv); + MultiThreadedLockableScore_free(this_obj_conv); +} + +uint32_t __attribute__((visibility("default"))) TS_MultiThreadedLockableScore_new(uint32_t score) { + void* score_ptr = (void*)(((uint64_t)score) & ~1); + CHECK_ACCESS(score_ptr); + LDKScore score_conv = *(LDKScore*)(score_ptr); + LDKMultiThreadedLockableScore ret_var = MultiThreadedLockableScore_new(score_conv); + uint64_t ret_ref = 0; + CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. + CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. + CHECK_INNER_FIELD_ACCESS_OR_NULL(ret_var); + ret_ref = (uint64_t)ret_var.inner; + if (ret_var.is_owned) { + ret_ref |= 1; + } + return ret_ref; +} + void __attribute__((visibility("default"))) TS_Scorer_free(uint32_t this_obj) { LDKScorer this_obj_conv; this_obj_conv.inner = (void*)(this_obj & (~1)); @@ -34189,6 +34911,40 @@ void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_pe ScoringParameters_set_failure_penalty_msat(&this_ptr_conv, val); } +int16_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_start_1024th(uint32_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int16_t ret_val = ScoringParameters_get_overuse_penalty_start_1024th(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_start_1024th(uint32_t this_ptr, int16_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_start_1024th(&this_ptr_conv, val); +} + +int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_overuse_penalty_msat_per_1024th(uint32_t this_ptr) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + int64_t ret_val = ScoringParameters_get_overuse_penalty_msat_per_1024th(&this_ptr_conv); + return ret_val; +} + +void __attribute__((visibility("default"))) TS_ScoringParameters_set_overuse_penalty_msat_per_1024th(uint32_t this_ptr, int64_t val) { + LDKScoringParameters this_ptr_conv; + this_ptr_conv.inner = (void*)(this_ptr & (~1)); + this_ptr_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_ptr_conv); + ScoringParameters_set_overuse_penalty_msat_per_1024th(&this_ptr_conv, val); +} + int64_t __attribute__((visibility("default"))) TS_ScoringParameters_get_failure_penalty_half_life(uint32_t this_ptr) { LDKScoringParameters this_ptr_conv; this_ptr_conv.inner = (void*)(this_ptr & (~1)); @@ -34206,8 +34962,8 @@ void __attribute__((visibility("default"))) TS_ScoringParameters_set_failure_pe ScoringParameters_set_failure_penalty_half_life(&this_ptr_conv, val); } -uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int64_t failure_penalty_half_life_arg) { - LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); +uint32_t __attribute__((visibility("default"))) TS_ScoringParameters_new(int64_t base_penalty_msat_arg, int64_t failure_penalty_msat_arg, int16_t overuse_penalty_start_1024th_arg, int64_t overuse_penalty_msat_per_1024th_arg, int64_t failure_penalty_half_life_arg) { + LDKScoringParameters ret_var = ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); uint64_t ret_ref = 0; CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this. CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this. @@ -36122,6 +36878,11 @@ uint32_t __attribute__((visibility("default"))) TS_CreationError_expiry_time_ou return ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_CreationError_invalid_amount() { + uint32_t ret_conv = LDKCreationError_to_js(CreationError_invalid_amount()); + return ret_conv; +} + jboolean __attribute__((visibility("default"))) TS_CreationError_eq(uint32_t a, uint32_t b) { LDKCreationError* a_conv = (LDKCreationError*)(a & ~1); LDKCreationError* b_conv = (LDKCreationError*)(b & ~1); @@ -36458,7 +37219,7 @@ uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_new(uint32_t pa void* router_ptr = (void*)(((uint64_t)router) & ~1); CHECK_ACCESS(router_ptr); LDKRouter router_conv = *(LDKRouter*)(router_ptr); - LDKLockableScore scorer_conv; + LDKMultiThreadedLockableScore scorer_conv; scorer_conv.inner = (void*)(scorer & (~1)); scorer_conv.is_owned = false; CHECK_INNER_FIELD_ACCESS_OR_NULL(scorer_conv); @@ -36513,6 +37274,22 @@ uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_zero_value_ return (uint64_t)ret_conv; } +uint32_t __attribute__((visibility("default"))) TS_InvoicePayer_pay_pubkey(uint32_t this_arg, int8_tArray pubkey, int8_tArray payment_preimage, int64_t amount_msats, int32_t final_cltv_expiry_delta) { + LDKInvoicePayer this_arg_conv; + this_arg_conv.inner = (void*)(this_arg & (~1)); + this_arg_conv.is_owned = false; + CHECK_INNER_FIELD_ACCESS_OR_NULL(this_arg_conv); + LDKPublicKey pubkey_ref; + CHECK(*((uint32_t*)pubkey) == 33); + memcpy(pubkey_ref.compressed_form, (uint8_t*)(pubkey + 4), 33); + LDKThirtyTwoBytes payment_preimage_ref; + CHECK(*((uint32_t*)payment_preimage) == 32); + memcpy(payment_preimage_ref.data, (uint8_t*)(payment_preimage + 4), 32); + LDKCResult_PaymentIdPaymentErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentIdPaymentErrorZ), "LDKCResult_PaymentIdPaymentErrorZ"); + *ret_conv = InvoicePayer_pay_pubkey(&this_arg_conv, pubkey_ref, payment_preimage_ref, amount_msats, final_cltv_expiry_delta); + return (uint64_t)ret_conv; +} + void __attribute__((visibility("default"))) TS_InvoicePayer_remove_cached_payment(uint32_t this_arg, int8_tArray payment_hash) { LDKInvoicePayer this_arg_conv; this_arg_conv.inner = (void*)(this_arg & (~1)); diff --git a/ts/bindings.ts b/ts/bindings.ts index 045a1f35..72348502 100644 --- a/ts/bindings.ts +++ b/ts/bindings.ts @@ -312,6 +312,9 @@ public static native long new_empty_slice_vec(); export class CommitmentTxConfirmed extends LDKClosureReason { CommitmentTxConfirmed() { } } + export class FundingTimedOut extends LDKClosureReason { + FundingTimedOut() { } + } export class ProcessingError extends LDKClosureReason { public String err; ProcessingError(String err) { this.err = err; } @@ -398,8 +401,7 @@ public static native long new_empty_slice_vec(); export class InvoicePayment extends LDKPaymentPurpose { public Uint8Array payment_preimage; public Uint8Array payment_secret; - public number user_payment_id; - InvoicePayment(Uint8Array payment_preimage, Uint8Array payment_secret, number user_payment_id) { this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; this.user_payment_id = user_payment_id; } + InvoicePayment(Uint8Array payment_preimage, Uint8Array payment_secret) { this.payment_preimage = payment_preimage; this.payment_secret = payment_secret; } } export class SpontaneousPayment extends LDKPaymentPurpose { public Uint8Array spontaneous_payment; @@ -442,6 +444,11 @@ public static native long new_empty_slice_vec(); public number retry; PaymentPathFailed(Uint8Array payment_id, Uint8Array payment_hash, boolean rejected_by_dest, number network_update, boolean all_paths_failed, number[] path, number short_channel_id, number retry) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; this.short_channel_id = short_channel_id; this.retry = retry; } } + export class PaymentFailed extends LDKEvent { + public Uint8Array payment_id; + public Uint8Array payment_hash; + PaymentFailed(Uint8Array payment_id, Uint8Array payment_hash) { this.payment_id = payment_id; this.payment_hash = payment_hash; } + } export class PendingHTLCsForwardable extends LDKEvent { public number time_forwardable; PendingHTLCsForwardable(number time_forwardable) { this.time_forwardable = time_forwardable; } @@ -466,6 +473,12 @@ public static native long new_empty_slice_vec(); public Uint8Array transaction; DiscardFunding(Uint8Array channel_id, Uint8Array transaction) { this.channel_id = channel_id; this.transaction = transaction; } } + export class PaymentPathSuccessful extends LDKEvent { + public Uint8Array payment_id; + public Uint8Array payment_hash; + public number[] path; + PaymentPathSuccessful(Uint8Array payment_id, Uint8Array payment_hash, number[] path) { this.payment_id = payment_id; this.payment_hash = payment_hash; this.path = path; } + } static native void init(); } static { LDKEvent.init(); } @@ -498,6 +511,9 @@ public static native long new_empty_slice_vec(); public Level ignore_and_log; IgnoreAndLog(Level ignore_and_log) { this.ignore_and_log = ignore_and_log; } } + export class IgnoreDuplicateGossip extends LDKErrorAction { + IgnoreDuplicateGossip() { } + } export class SendErrorMessage extends LDKErrorAction { public number msg; SendErrorMessage(number msg) { this.msg = msg; } @@ -605,18 +621,20 @@ public static native long new_empty_slice_vec(); } static { LDKMessageSendEvent.init(); } public static native LDKMessageSendEvent LDKMessageSendEvent_ref_from_ptr(long ptr); + public static native number LDKCResult_ScoringParametersDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_ScoringParametersDecodeErrorZ_get_err(long arg); + public static native number LDKCResult_ScorerDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_ScorerDecodeErrorZ_get_err(long arg); public static native number LDKCResult_InitFeaturesDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_InitFeaturesDecodeErrorZ_get_err(long arg); - public static native number LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(long arg); - public static native number LDKCResult_NodeFeaturesDecodeErrorZ_get_err(long arg); public static native number LDKCResult_ChannelFeaturesDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_ChannelFeaturesDecodeErrorZ_get_err(long arg); + public static native number LDKCResult_NodeFeaturesDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_NodeFeaturesDecodeErrorZ_get_err(long arg); public static native number LDKCResult_InvoiceFeaturesDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_InvoiceFeaturesDecodeErrorZ_get_err(long arg); - public static native number LDKCResult_ScoringParametersDecodeErrorZ_get_ok(long arg); - public static native number LDKCResult_ScoringParametersDecodeErrorZ_get_err(long arg); - public static native number LDKCResult_ScorerDecodeErrorZ_get_ok(long arg); - public static native number LDKCResult_ScorerDecodeErrorZ_get_err(long arg); + public static native number LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(long arg); + public static native number LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(long arg); public static native number LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ_get_err(long arg); public static native number LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ_get_ok(long arg); @@ -943,9 +961,8 @@ public static native long new_empty_slice_vec(); IPv6(Uint8Array addr, number port) { this.addr = addr; this.port = port; } } export class OnionV2 extends LDKNetAddress { - public Uint8Array addr; - public number port; - OnionV2(Uint8Array addr, number port) { this.addr = addr; this.port = port; } + public Uint8Array onion_v2; + OnionV2(Uint8Array onion_v2) { this.onion_v2 = onion_v2; } } export class OnionV3 extends LDKNetAddress { public Uint8Array ed25519_pubkey; @@ -974,8 +991,16 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentSecretZ_get_b(tuple); return decodeArray(nativeResponseValue); } + public static native number LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(long arg); + public static native void LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_err(long arg); + public static native number LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(long arg); + public static native number LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(long arg); + public static native Uint8Array LDKCResult_PaymentSecretNoneZ_get_ok(long arg); + public static native void LDKCResult_PaymentSecretNoneZ_get_err(long arg); public static native Uint8Array LDKCResult_PaymentSecretAPIErrorZ_get_ok(long arg); public static native number LDKCResult_PaymentSecretAPIErrorZ_get_err(long arg); + public static native Uint8Array LDKCResult_PaymentPreimageAPIErrorZ_get_ok(long arg); + public static native number LDKCResult_PaymentPreimageAPIErrorZ_get_err(long arg); @@ -1055,6 +1080,7 @@ public static native long new_empty_slice_vec(); get_secure_random_bytes (): Uint8Array; read_chan_signer (reader: Uint8Array): number; sign_invoice (invoice_preimage: Uint8Array): number; + get_inbound_payment_key_material (): Uint8Array; } export function LDKKeysInterface_new(impl: LDKKeysInterface): number { @@ -1120,6 +1146,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.KeysInterface_sign_invoice(this_arg, encodeArray(invoice_preimage)); return nativeResponseValue; } + // LDKThirtyTwoBytes KeysInterface_get_inbound_payment_key_material LDKKeysInterface *NONNULL_PTR this_arg + export function KeysInterface_get_inbound_payment_key_material(this_arg: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.KeysInterface_get_inbound_payment_key_material(this_arg); + return decodeArray(nativeResponseValue); + } @@ -1324,8 +1358,6 @@ public static native long new_empty_slice_vec(); public static native number LDKCResult_COption_MonitorEventZDecodeErrorZ_get_err(long arg); public static native number LDKCResult_HTLCUpdateDecodeErrorZ_get_ok(long arg); public static native number LDKCResult_HTLCUpdateDecodeErrorZ_get_err(long arg); - public static native void LDKCResult_NoneMonitorUpdateErrorZ_get_ok(long arg); - public static native number LDKCResult_NoneMonitorUpdateErrorZ_get_err(long arg); // struct LDKOutPoint C2Tuple_OutPointScriptZ_get_a(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR tuple); export function C2Tuple_OutPointScriptZ_get_a(tuple: number): number { if(!isWasmInitialized) { @@ -2273,8 +2305,9 @@ public static native long new_empty_slice_vec(); // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START export interface LDKScore { - channel_penalty_msat (short_channel_id: number, source: number, target: number): number; + channel_penalty_msat (short_channel_id: number, send_amt_msat: number, channel_capacity_msat: number, source: number, target: number): number; payment_path_failed (path: number[], short_channel_id: number): void; + payment_path_successful (path: number[]): void; write (): Uint8Array; } @@ -2285,12 +2318,12 @@ public static native long new_empty_slice_vec(); // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END - // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target - export function Score_channel_penalty_msat(this_arg: number, short_channel_id: number, source: number, target: number): number { + // uint64_t Score_channel_penalty_msat LDKScore *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, struct LDKCOption_u64Z channel_capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target + export function Score_channel_penalty_msat(this_arg: number, short_channel_id: number, send_amt_msat: number, channel_capacity_msat: number, source: number, target: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Score_channel_penalty_msat(this_arg, short_channel_id, source, target); + const nativeResponseValue = wasm.Score_channel_penalty_msat(this_arg, short_channel_id, send_amt_msat, channel_capacity_msat, source, target); return nativeResponseValue; } // void Score_payment_path_failed LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id @@ -2301,6 +2334,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Score_payment_path_failed(this_arg, path, short_channel_id); // debug statements here } + // void Score_payment_path_successful LDKScore *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ path + export function Score_payment_path_successful(this_arg: number, path: number[]): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Score_payment_path_successful(this_arg, path); + // debug statements here + } // LDKCVec_u8Z Score_write LDKScore *NONNULL_PTR this_arg export function Score_write(this_arg: number): Uint8Array { if(!isWasmInitialized) { @@ -2312,6 +2353,30 @@ public static native long new_empty_slice_vec(); +// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START + + export interface LDKLockableScore { + lock (): number; + } + + export function LDKLockableScore_new(impl: LDKLockableScore): number { + throw new Error('unimplemented'); // TODO: bind to WASM + } + +// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END + + + // LDKScore LockableScore_lock LDKLockableScore *NONNULL_PTR this_arg + export function LockableScore_lock(this_arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.LockableScore_lock(this_arg); + return nativeResponseValue; + } + + + // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START export interface LDKChannelManagerPersister { @@ -2361,7 +2426,9 @@ public static native long new_empty_slice_vec(); node_id (): Uint8Array; first_hops (): number[]; send_payment (route: number, payment_hash: Uint8Array, payment_secret: Uint8Array): number; + send_spontaneous_payment (route: number, payment_preimage: Uint8Array): number; retry_payment (route: number, payment_id: Uint8Array): number; + abandon_payment (payment_id: Uint8Array): void; } export function LDKPayer_new(impl: LDKPayer): number { @@ -2395,6 +2462,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Payer_send_payment(this_arg, route, encodeArray(payment_hash), encodeArray(payment_secret)); return nativeResponseValue; } + // LDKCResult_PaymentIdPaymentSendFailureZ Payer_send_spontaneous_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage + export function Payer_send_spontaneous_payment(this_arg: number, route: number, payment_preimage: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Payer_send_spontaneous_payment(this_arg, route, encodeArray(payment_preimage)); + return nativeResponseValue; + } // LDKCResult_NonePaymentSendFailureZ Payer_retry_payment LDKPayer *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id export function Payer_retry_payment(this_arg: number, route: number, payment_id: Uint8Array): number { if(!isWasmInitialized) { @@ -2403,13 +2478,21 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Payer_retry_payment(this_arg, route, encodeArray(payment_id)); return nativeResponseValue; } + // void Payer_abandon_payment LDKPayer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id + export function Payer_abandon_payment(this_arg: number, payment_id: Uint8Array): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Payer_abandon_payment(this_arg, encodeArray(payment_id)); + // debug statements here + } // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START export interface LDKRouter { - find_route (payer: Uint8Array, params: number, first_hops: number[], scorer: number): number; + find_route (payer: Uint8Array, params: number, payment_hash: Uint8Array, first_hops: number[], scorer: number): number; } export function LDKRouter_new(impl: LDKRouter): number { @@ -2419,12 +2502,12 @@ public static native long new_empty_slice_vec(); // OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END - // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer - export function Router_find_route(this_arg: number, payer: Uint8Array, params: number, first_hops: number[], scorer: number): number { + // LDKCResult_RouteLightningErrorZ Router_find_route LDKRouter *NONNULL_PTR this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer + export function Router_find_route(this_arg: number, payer: Uint8Array, params: number, payment_hash: Uint8Array, first_hops: number[], scorer: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.Router_find_route(this_arg, encodeArray(payer), params, first_hops, scorer); + const nativeResponseValue = wasm.Router_find_route(this_arg, encodeArray(payer), params, encodeArray(payment_hash), first_hops, scorer); return nativeResponseValue; } // struct LDKStr _ldk_get_compiled_version(void); @@ -2803,6 +2886,30 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig); return nativeResponseValue; } + // enum LDKCOption_NoneZ COption_NoneZ_some(void); + export function COption_NoneZ_some(): COption_NoneZ { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_NoneZ_some(); + return nativeResponseValue; + } + // enum LDKCOption_NoneZ COption_NoneZ_none(void); + export function COption_NoneZ_none(): COption_NoneZ { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_NoneZ_none(); + return nativeResponseValue; + } + // void COption_NoneZ_free(enum LDKCOption_NoneZ _res); + export function COption_NoneZ_free(_res: COption_NoneZ): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.COption_NoneZ_free(_res); + // debug statements here + } // struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); export function CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { @@ -4147,68 +4254,100 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CVec_MessageSendEventZ_free(_res); // debug statements here } - // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); - export function CResult_InitFeaturesDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); + export function CResult_ScoringParametersDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_InitFeaturesDecodeErrorZ_err(e: number): number { + // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_ScoringParametersDecodeErrorZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_err(e); return nativeResponseValue; } - // bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); - export function CResult_InitFeaturesDecodeErrorZ_is_ok(o: number): boolean { + // bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); + export function CResult_ScoringParametersDecodeErrorZ_is_ok(o: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_is_ok(o); + const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_is_ok(o); return nativeResponseValue; } - // void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); - export function CResult_InitFeaturesDecodeErrorZ_free(_res: number): void { + // void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); + export function CResult_ScoringParametersDecodeErrorZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_free(_res); // debug statements here } - // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); - export function CResult_NodeFeaturesDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); + export function CResult_ScorerDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_NodeFeaturesDecodeErrorZ_err(e: number): number { + // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_ScorerDecodeErrorZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_err(e); return nativeResponseValue; } - // bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); - export function CResult_NodeFeaturesDecodeErrorZ_is_ok(o: number): boolean { + // bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); + export function CResult_ScorerDecodeErrorZ_is_ok(o: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_is_ok(o); + const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_is_ok(o); return nativeResponseValue; } - // void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); - export function CResult_NodeFeaturesDecodeErrorZ_free(_res: number): void { + // void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); + export function CResult_ScorerDecodeErrorZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_free(_res); + // debug statements here + } + // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); + export function CResult_InitFeaturesDecodeErrorZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_InitFeaturesDecodeErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_err(e); + return nativeResponseValue; + } + // bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); + export function CResult_InitFeaturesDecodeErrorZ_is_ok(o: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_is_ok(o); + return nativeResponseValue; + } + // void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); + export function CResult_InitFeaturesDecodeErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_InitFeaturesDecodeErrorZ_free(_res); // debug statements here } // struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); @@ -4243,100 +4382,100 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_ChannelFeaturesDecodeErrorZ_free(_res); // debug statements here } - // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); - export function CResult_InvoiceFeaturesDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); + export function CResult_NodeFeaturesDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_InvoiceFeaturesDecodeErrorZ_err(e: number): number { + // struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_NodeFeaturesDecodeErrorZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_err(e); return nativeResponseValue; } - // bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); - export function CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: number): boolean { + // bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); + export function CResult_NodeFeaturesDecodeErrorZ_is_ok(o: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o); + const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_is_ok(o); return nativeResponseValue; } - // void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); - export function CResult_InvoiceFeaturesDecodeErrorZ_free(_res: number): void { + // void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); + export function CResult_NodeFeaturesDecodeErrorZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_NodeFeaturesDecodeErrorZ_free(_res); // debug statements here } - // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); - export function CResult_ScoringParametersDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); + export function CResult_InvoiceFeaturesDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_ScoringParametersDecodeErrorZ_err(e: number): number { + // struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_InvoiceFeaturesDecodeErrorZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_err(e); return nativeResponseValue; } - // bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); - export function CResult_ScoringParametersDecodeErrorZ_is_ok(o: number): boolean { + // bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + export function CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_is_ok(o); + const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_is_ok(o); return nativeResponseValue; } - // void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); - export function CResult_ScoringParametersDecodeErrorZ_free(_res: number): void { + // void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); + export function CResult_InvoiceFeaturesDecodeErrorZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScoringParametersDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_InvoiceFeaturesDecodeErrorZ_free(_res); // debug statements here } - // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); - export function CResult_ScorerDecodeErrorZ_ok(o: number): number { + // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); + export function CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_ok(o); + const nativeResponseValue = wasm.CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o); return nativeResponseValue; } - // struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); - export function CResult_ScorerDecodeErrorZ_err(e: number): number { + // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + export function CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_err(e); + const nativeResponseValue = wasm.CResult_ChannelTypeFeaturesDecodeErrorZ_err(e); return nativeResponseValue; } - // bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); - export function CResult_ScorerDecodeErrorZ_is_ok(o: number): boolean { + // bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); + export function CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_is_ok(o); + const nativeResponseValue = wasm.CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o); return nativeResponseValue; } - // void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); - export function CResult_ScorerDecodeErrorZ_free(_res: number): void { + // void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); + export function CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.CResult_ScorerDecodeErrorZ_free(_res); + const nativeResponseValue = wasm.CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res); // debug statements here } // struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); @@ -5379,6 +5518,150 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.C2Tuple_PaymentHashPaymentSecretZ_free(_res); // debug statements here } + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); + export function CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); + export function CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + return nativeResponseValue; + } + // bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); + export function CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(o); + return nativeResponseValue; + } + // void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); + export function CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(_res); + // debug statements here + } + // uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR arg); + export function CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(arg); + return nativeResponseValue; + } + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); + export function CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(orig); + return nativeResponseValue; + } + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); + export function CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o); + return nativeResponseValue; + } + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); + export function CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e); + return nativeResponseValue; + } + // bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); + export function CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(o); + return nativeResponseValue; + } + // void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); + export function CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(_res); + // debug statements here + } + // uint64_t CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR arg); + export function CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(arg); + return nativeResponseValue; + } + // struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); + export function CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(orig); + return nativeResponseValue; + } + // struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); + export function CResult_PaymentSecretNoneZ_ok(o: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentSecretNoneZ_ok(encodeArray(o)); + return nativeResponseValue; + } + // struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); + export function CResult_PaymentSecretNoneZ_err(): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentSecretNoneZ_err(); + return nativeResponseValue; + } + // bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); + export function CResult_PaymentSecretNoneZ_is_ok(o: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentSecretNoneZ_is_ok(o); + return nativeResponseValue; + } + // void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); + export function CResult_PaymentSecretNoneZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentSecretNoneZ_free(_res); + // debug statements here + } + // uint64_t CResult_PaymentSecretNoneZ_clone_ptr(LDKCResult_PaymentSecretNoneZ *NONNULL_PTR arg); + export function CResult_PaymentSecretNoneZ_clone_ptr(arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentSecretNoneZ_clone_ptr(arg); + return nativeResponseValue; + } + // struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); + export function CResult_PaymentSecretNoneZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentSecretNoneZ_clone(orig); + return nativeResponseValue; + } // struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); export function CResult_PaymentSecretAPIErrorZ_ok(o: Uint8Array): number { if(!isWasmInitialized) { @@ -5427,6 +5710,54 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_PaymentSecretAPIErrorZ_clone(orig); return nativeResponseValue; } + // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); + export function CResult_PaymentPreimageAPIErrorZ_ok(o: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentPreimageAPIErrorZ_ok(encodeArray(o)); + return nativeResponseValue; + } + // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); + export function CResult_PaymentPreimageAPIErrorZ_err(e: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentPreimageAPIErrorZ_err(e); + return nativeResponseValue; + } + // bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); + export function CResult_PaymentPreimageAPIErrorZ_is_ok(o: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentPreimageAPIErrorZ_is_ok(o); + return nativeResponseValue; + } + // void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); + export function CResult_PaymentPreimageAPIErrorZ_free(_res: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentPreimageAPIErrorZ_free(_res); + // debug statements here + } + // uint64_t CResult_PaymentPreimageAPIErrorZ_clone_ptr(LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR arg); + export function CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentPreimageAPIErrorZ_clone_ptr(arg); + return nativeResponseValue; + } + // struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); + export function CResult_PaymentPreimageAPIErrorZ_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CResult_PaymentPreimageAPIErrorZ_clone(orig); + return nativeResponseValue; + } // void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); export function CVec_ChannelMonitorZ_free(_res: number[]): void { if(!isWasmInitialized) { @@ -6451,54 +6782,6 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CResult_HTLCUpdateDecodeErrorZ_clone(orig); return nativeResponseValue; } - // struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_ok(void); - export function CResult_NoneMonitorUpdateErrorZ_ok(): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.CResult_NoneMonitorUpdateErrorZ_ok(); - return nativeResponseValue; - } - // struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_err(struct LDKMonitorUpdateError e); - export function CResult_NoneMonitorUpdateErrorZ_err(e: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.CResult_NoneMonitorUpdateErrorZ_err(e); - return nativeResponseValue; - } - // bool CResult_NoneMonitorUpdateErrorZ_is_ok(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR o); - export function CResult_NoneMonitorUpdateErrorZ_is_ok(o: number): boolean { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.CResult_NoneMonitorUpdateErrorZ_is_ok(o); - return nativeResponseValue; - } - // void CResult_NoneMonitorUpdateErrorZ_free(struct LDKCResult_NoneMonitorUpdateErrorZ _res); - export function CResult_NoneMonitorUpdateErrorZ_free(_res: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.CResult_NoneMonitorUpdateErrorZ_free(_res); - // debug statements here - } - // uint64_t CResult_NoneMonitorUpdateErrorZ_clone_ptr(LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR arg); - export function CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.CResult_NoneMonitorUpdateErrorZ_clone_ptr(arg); - return nativeResponseValue; - } - // struct LDKCResult_NoneMonitorUpdateErrorZ CResult_NoneMonitorUpdateErrorZ_clone(const struct LDKCResult_NoneMonitorUpdateErrorZ *NONNULL_PTR orig); - export function CResult_NoneMonitorUpdateErrorZ_clone(orig: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.CResult_NoneMonitorUpdateErrorZ_clone(orig); - return nativeResponseValue; - } // uint64_t C2Tuple_OutPointScriptZ_clone_ptr(LDKC2Tuple_OutPointScriptZ *NONNULL_PTR arg); export function C2Tuple_OutPointScriptZ_clone_ptr(arg: number): number { if(!isWasmInitialized) { @@ -9307,12 +9590,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.PaymentPurpose_clone(orig); return nativeResponseValue; } - // struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret, uint64_t user_payment_id); - export function PaymentPurpose_invoice_payment(payment_preimage: Uint8Array, payment_secret: Uint8Array, user_payment_id: number): number { + // struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret); + export function PaymentPurpose_invoice_payment(payment_preimage: Uint8Array, payment_secret: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.PaymentPurpose_invoice_payment(encodeArray(payment_preimage), encodeArray(payment_secret), user_payment_id); + const nativeResponseValue = wasm.PaymentPurpose_invoice_payment(encodeArray(payment_preimage), encodeArray(payment_secret)); return nativeResponseValue; } // struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); @@ -9379,6 +9662,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ClosureReason_commitment_tx_confirmed(); return nativeResponseValue; } + // struct LDKClosureReason ClosureReason_funding_timed_out(void); + export function ClosureReason_funding_timed_out(): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ClosureReason_funding_timed_out(); + return nativeResponseValue; + } // struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); export function ClosureReason_processing_error(err: String): number { if(!isWasmInitialized) { @@ -9475,6 +9766,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Event_payment_path_failed(encodeArray(payment_id), encodeArray(payment_hash), rejected_by_dest, network_update, all_paths_failed, path, short_channel_id, retry); return nativeResponseValue; } + // struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); + export function Event_payment_failed(payment_id: Uint8Array, payment_hash: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Event_payment_failed(encodeArray(payment_id), encodeArray(payment_hash)); + return nativeResponseValue; + } // struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); export function Event_pending_htlcs_forwardable(time_forwardable: number): number { if(!isWasmInitialized) { @@ -9515,6 +9814,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Event_discard_funding(encodeArray(channel_id), encodeArray(transaction)); return nativeResponseValue; } + // struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); + export function Event_payment_path_successful(payment_id: Uint8Array, payment_hash: Uint8Array, path: number[]): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Event_payment_path_successful(encodeArray(payment_id), encodeArray(payment_hash), path); + return nativeResponseValue; + } // struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); export function Event_write(obj: number): Uint8Array { if(!isWasmInitialized) { @@ -9835,6 +10142,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Level_clone(orig); return nativeResponseValue; } + // enum LDKLevel Level_gossip(void); + export function Level_gossip(): Level { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Level_gossip(); + return nativeResponseValue; + } // enum LDKLevel Level_trace(void); export function Level_trace(): Level { if(!isWasmInitialized) { @@ -10507,12 +10822,28 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.UserConfig_set_accept_forwards_to_priv_channels(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg); - export function UserConfig_new(own_channel_config_arg: number, peer_channel_config_limits_arg: number, channel_options_arg: number, accept_forwards_to_priv_channels_arg: boolean): number { + // bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); + export function UserConfig_get_accept_inbound_channels(this_ptr: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.UserConfig_get_accept_inbound_channels(this_ptr); + return nativeResponseValue; + } + // void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); + export function UserConfig_set_accept_inbound_channels(this_ptr: number, val: boolean): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.UserConfig_set_accept_inbound_channels(this_ptr, val); + // debug statements here + } + // MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg); + export function UserConfig_new(own_channel_config_arg: number, peer_channel_config_limits_arg: number, channel_options_arg: number, accept_forwards_to_priv_channels_arg: boolean, accept_inbound_channels_arg: boolean): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.UserConfig_new(own_channel_config_arg, peer_channel_config_limits_arg, channel_options_arg, accept_forwards_to_priv_channels_arg); + const nativeResponseValue = wasm.UserConfig_new(own_channel_config_arg, peer_channel_config_limits_arg, channel_options_arg, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); return nativeResponseValue; } // uint64_t UserConfig_clone_ptr(LDKUserConfig *NONNULL_PTR arg); @@ -10971,100 +11302,52 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelMonitorUpdate_free(this_obj); // debug statements here } - // uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); - export function ChannelMonitorUpdate_get_update_id(this_ptr: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdate_get_update_id(this_ptr); - return nativeResponseValue; - } - // void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); - export function ChannelMonitorUpdate_set_update_id(this_ptr: number, val: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdate_set_update_id(this_ptr, val); - // debug statements here - } - // uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg); - export function ChannelMonitorUpdate_clone_ptr(arg: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdate_clone_ptr(arg); - return nativeResponseValue; - } - // struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); - export function ChannelMonitorUpdate_clone(orig: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdate_clone(orig); - return nativeResponseValue; - } - // struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); - export function ChannelMonitorUpdate_write(obj: number): Uint8Array { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdate_write(obj); - return decodeArray(nativeResponseValue); - } - // struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); - export function ChannelMonitorUpdate_read(ser: Uint8Array): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelMonitorUpdate_read(encodeArray(ser)); - return nativeResponseValue; - } - // void MonitorUpdateError_free(struct LDKMonitorUpdateError this_obj); - export function MonitorUpdateError_free(this_obj: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.MonitorUpdateError_free(this_obj); - // debug statements here - } - // struct LDKStr MonitorUpdateError_get_a(const struct LDKMonitorUpdateError *NONNULL_PTR this_ptr); - export function MonitorUpdateError_get_a(this_ptr: number): String { + // uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr); + export function ChannelMonitorUpdate_get_update_id(this_ptr: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.MonitorUpdateError_get_a(this_ptr); + const nativeResponseValue = wasm.ChannelMonitorUpdate_get_update_id(this_ptr); return nativeResponseValue; } - // void MonitorUpdateError_set_a(struct LDKMonitorUpdateError *NONNULL_PTR this_ptr, struct LDKStr val); - export function MonitorUpdateError_set_a(this_ptr: number, val: String): void { + // void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val); + export function ChannelMonitorUpdate_set_update_id(this_ptr: number, val: number): void { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.MonitorUpdateError_set_a(this_ptr, val); + const nativeResponseValue = wasm.ChannelMonitorUpdate_set_update_id(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKMonitorUpdateError MonitorUpdateError_new(struct LDKStr a_arg); - export function MonitorUpdateError_new(a_arg: String): number { + // uint64_t ChannelMonitorUpdate_clone_ptr(LDKChannelMonitorUpdate *NONNULL_PTR arg); + export function ChannelMonitorUpdate_clone_ptr(arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.MonitorUpdateError_new(a_arg); + const nativeResponseValue = wasm.ChannelMonitorUpdate_clone_ptr(arg); return nativeResponseValue; } - // uint64_t MonitorUpdateError_clone_ptr(LDKMonitorUpdateError *NONNULL_PTR arg); - export function MonitorUpdateError_clone_ptr(arg: number): number { + // struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig); + export function ChannelMonitorUpdate_clone(orig: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.MonitorUpdateError_clone_ptr(arg); + const nativeResponseValue = wasm.ChannelMonitorUpdate_clone(orig); return nativeResponseValue; } - // struct LDKMonitorUpdateError MonitorUpdateError_clone(const struct LDKMonitorUpdateError *NONNULL_PTR orig); - export function MonitorUpdateError_clone(orig: number): number { + // struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj); + export function ChannelMonitorUpdate_write(obj: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelMonitorUpdate_write(obj); + return decodeArray(nativeResponseValue); + } + // struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser); + export function ChannelMonitorUpdate_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.MonitorUpdateError_clone(orig); + const nativeResponseValue = wasm.ChannelMonitorUpdate_read(encodeArray(ser)); return nativeResponseValue; } // void MonitorEvent_free(struct LDKMonitorEvent this_ptr); @@ -11275,7 +11558,7 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelMonitor_write(obj); return decodeArray(nativeResponseValue); } - // MUST_USE_RES struct LDKCResult_NoneMonitorUpdateErrorZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); + // MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); export function ChannelMonitor_update_monitor(this_arg: number, updates: number, broadcaster: number, fee_estimator: number, logger: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); @@ -12051,6 +12334,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InMemorySigner_get_channel_parameters(this_arg); return nativeResponseValue; } + // MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); + export function InMemorySigner_opt_anchors(this_arg: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.InMemorySigner_opt_anchors(this_arg); + return nativeResponseValue; + } // MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); export function InMemorySigner_sign_counterparty_payment_input(this_arg: number, spend_tx: Uint8Array, input_idx: number, descriptor: number): number { if(!isWasmInitialized) { @@ -12507,6 +12798,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelDetails_set_user_channel_id(this_ptr, val); // debug statements here } + // uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + export function ChannelDetails_get_balance_msat(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelDetails_get_balance_msat(this_ptr); + return nativeResponseValue; + } + // void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + export function ChannelDetails_set_balance_msat(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelDetails_set_balance_msat(this_ptr, val); + // debug statements here + } // uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); export function ChannelDetails_get_outbound_capacity_msat(this_ptr: number): number { if(!isWasmInitialized) { @@ -12635,12 +12942,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelDetails_set_is_public(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); - export function ChannelDetails_new(channel_id_arg: Uint8Array, counterparty_arg: number, funding_txo_arg: number, short_channel_id_arg: number, channel_value_satoshis_arg: number, unspendable_punishment_reserve_arg: number, user_channel_id_arg: number, outbound_capacity_msat_arg: number, inbound_capacity_msat_arg: number, confirmations_required_arg: number, force_close_spend_delay_arg: number, is_outbound_arg: boolean, is_funding_locked_arg: boolean, is_usable_arg: boolean, is_public_arg: boolean): number { + // MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKCOption_u64Z short_channel_id_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_arg); + export function ChannelDetails_new(channel_id_arg: Uint8Array, counterparty_arg: number, funding_txo_arg: number, short_channel_id_arg: number, channel_value_satoshis_arg: number, unspendable_punishment_reserve_arg: number, user_channel_id_arg: number, balance_msat_arg: number, outbound_capacity_msat_arg: number, inbound_capacity_msat_arg: number, confirmations_required_arg: number, force_close_spend_delay_arg: number, is_outbound_arg: boolean, is_funding_locked_arg: boolean, is_usable_arg: boolean, is_public_arg: boolean): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelDetails_new(encodeArray(channel_id_arg), counterparty_arg, funding_txo_arg, short_channel_id_arg, channel_value_satoshis_arg, unspendable_punishment_reserve_arg, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg, force_close_spend_delay_arg, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + const nativeResponseValue = wasm.ChannelDetails_new(encodeArray(channel_id_arg), counterparty_arg, funding_txo_arg, short_channel_id_arg, channel_value_satoshis_arg, unspendable_punishment_reserve_arg, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg, force_close_spend_delay_arg, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); return nativeResponseValue; } // uint64_t ChannelDetails_clone_ptr(LDKChannelDetails *NONNULL_PTR arg); @@ -12803,6 +13110,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_retry_payment(this_arg, route, encodeArray(payment_id)); return nativeResponseValue; } + // void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); + export function ChannelManager_abandon_payment(this_arg: number, payment_id: Uint8Array): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_abandon_payment(this_arg, encodeArray(payment_id)); + // debug statements here + } // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); export function ChannelManager_send_spontaneous_payment(this_arg: number, route: number, payment_preimage: Uint8Array): number { if(!isWasmInitialized) { @@ -12867,20 +13182,44 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelManager_get_our_node_id(this_arg); return decodeArray(nativeResponseValue); } - // MUST_USE_RES struct LDKC2Tuple_PaymentHashPaymentSecretZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id); - export function ChannelManager_create_inbound_payment(this_arg: number, min_value_msat: number, invoice_expiry_delta_secs: number, user_payment_id: number): number { + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + export function ChannelManager_create_inbound_payment(this_arg: number, min_value_msat: number, invoice_expiry_delta_secs: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_create_inbound_payment(this_arg, min_value_msat, invoice_expiry_delta_secs); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ChannelManager_create_inbound_payment_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + export function ChannelManager_create_inbound_payment_legacy(this_arg: number, min_value_msat: number, invoice_expiry_delta_secs: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelManager_create_inbound_payment(this_arg, min_value_msat, invoice_expiry_delta_secs, user_payment_id); + const nativeResponseValue = wasm.ChannelManager_create_inbound_payment_legacy(this_arg, min_value_msat, invoice_expiry_delta_secs); return nativeResponseValue; } - // MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, uint64_t user_payment_id); - export function ChannelManager_create_inbound_payment_for_hash(this_arg: number, payment_hash: Uint8Array, min_value_msat: number, invoice_expiry_delta_secs: number, user_payment_id: number): number { + // MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + export function ChannelManager_create_inbound_payment_for_hash(this_arg: number, payment_hash: Uint8Array, min_value_msat: number, invoice_expiry_delta_secs: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelManager_create_inbound_payment_for_hash(this_arg, encodeArray(payment_hash), min_value_msat, invoice_expiry_delta_secs, user_payment_id); + const nativeResponseValue = wasm.ChannelManager_create_inbound_payment_for_hash(this_arg, encodeArray(payment_hash), min_value_msat, invoice_expiry_delta_secs); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKCResult_PaymentSecretAPIErrorZ ChannelManager_create_inbound_payment_for_hash_legacy(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); + export function ChannelManager_create_inbound_payment_for_hash_legacy(this_arg: number, payment_hash: Uint8Array, min_value_msat: number, invoice_expiry_delta_secs: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_create_inbound_payment_for_hash_legacy(this_arg, encodeArray(payment_hash), min_value_msat, invoice_expiry_delta_secs); + return nativeResponseValue; + } + // MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payment_preimage(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + export function ChannelManager_get_payment_preimage(this_arg: number, payment_hash: Uint8Array, payment_secret: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelManager_get_payment_preimage(this_arg, encodeArray(payment_hash), encodeArray(payment_secret)); return nativeResponseValue; } // struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -13619,6 +13958,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.OpenChannel_set_channel_flags(this_ptr, val); // debug statements here } + // struct LDKChannelTypeFeatures OpenChannel_get_channel_type(const struct LDKOpenChannel *NONNULL_PTR this_ptr); + export function OpenChannel_get_channel_type(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.OpenChannel_get_channel_type(this_ptr); + return nativeResponseValue; + } + // void OpenChannel_set_channel_type(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); + export function OpenChannel_set_channel_type(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.OpenChannel_set_channel_type(this_ptr, val); + // debug statements here + } // uint64_t OpenChannel_clone_ptr(LDKOpenChannel *NONNULL_PTR arg); export function OpenChannel_clone_ptr(arg: number): number { if(!isWasmInitialized) { @@ -15131,12 +15486,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.NetAddress_ipv6(encodeArray(addr), port); return nativeResponseValue; } - // struct LDKNetAddress NetAddress_onion_v2(struct LDKTenBytes addr, uint16_t port); - export function NetAddress_onion_v2(addr: Uint8Array, port: number): number { + // struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); + export function NetAddress_onion_v2(a: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NetAddress_onion_v2(encodeArray(addr), port); + const nativeResponseValue = wasm.NetAddress_onion_v2(encodeArray(a)); return nativeResponseValue; } // struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); @@ -16235,6 +16590,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ErrorAction_ignore_and_log(a); return nativeResponseValue; } + // struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); + export function ErrorAction_ignore_duplicate_gossip(): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ErrorAction_ignore_duplicate_gossip(); + return nativeResponseValue; + } // struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); export function ErrorAction_send_error_message(msg: number): number { if(!isWasmInitialized) { @@ -17275,6 +17638,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.PeerManager_timer_tick_occurred(this_arg); // debug statements here } + // uint64_t htlc_success_tx_weight(bool opt_anchors); + export function htlc_success_tx_weight(opt_anchors: boolean): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.htlc_success_tx_weight(opt_anchors); + return nativeResponseValue; + } + // uint64_t htlc_timeout_tx_weight(bool opt_anchors); + export function htlc_timeout_tx_weight(opt_anchors: boolean): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.htlc_timeout_tx_weight(opt_anchors); + return nativeResponseValue; + } // struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); export function build_commitment_secret(commitment_seed: Uint8Array, idx: number): Uint8Array { if(!isWasmInitialized) { @@ -17731,12 +18110,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.HTLCOutputInCommitment_read(encodeArray(ser)); return nativeResponseValue; } - // struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKTxCreationKeys *NONNULL_PTR keys); - export function get_htlc_redeemscript(htlc: number, keys: number): Uint8Array { + // struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, const struct LDKTxCreationKeys *NONNULL_PTR keys); + export function get_htlc_redeemscript(htlc: number, opt_anchors: boolean, keys: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.get_htlc_redeemscript(htlc, keys); + const nativeResponseValue = wasm.get_htlc_redeemscript(htlc, opt_anchors, keys); return decodeArray(nativeResponseValue); } // struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); @@ -17747,12 +18126,20 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.make_funding_redeemscript(encodeArray(broadcaster), encodeArray(countersignatory)); return decodeArray(nativeResponseValue); } - // struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); - export function build_htlc_transaction(commitment_txid: Uint8Array, feerate_per_kw: number, contest_delay: number, htlc: number, broadcaster_delayed_payment_key: Uint8Array, revocation_key: Uint8Array): Uint8Array { + // struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); + export function build_htlc_transaction(commitment_txid: Uint8Array, feerate_per_kw: number, contest_delay: number, htlc: number, opt_anchors: boolean, broadcaster_delayed_payment_key: Uint8Array, revocation_key: Uint8Array): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.build_htlc_transaction(encodeArray(commitment_txid), feerate_per_kw, contest_delay, htlc, opt_anchors, encodeArray(broadcaster_delayed_payment_key), encodeArray(revocation_key)); + return decodeArray(nativeResponseValue); + } + // struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); + export function get_anchor_redeemscript(funding_pubkey: Uint8Array): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.build_htlc_transaction(encodeArray(commitment_txid), feerate_per_kw, contest_delay, htlc, encodeArray(broadcaster_delayed_payment_key), encodeArray(revocation_key)); + const nativeResponseValue = wasm.get_anchor_redeemscript(encodeArray(funding_pubkey)); return decodeArray(nativeResponseValue); } // void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); @@ -17843,12 +18230,28 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelTransactionParameters_set_funding_outpoint(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg); - export function ChannelTransactionParameters_new(holder_pubkeys_arg: number, holder_selected_contest_delay_arg: number, is_outbound_from_holder_arg: boolean, counterparty_parameters_arg: number, funding_outpoint_arg: number): number { + // enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + export function ChannelTransactionParameters_get_opt_anchors(this_ptr: number): COption_NoneZ { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTransactionParameters_get_opt_anchors(this_ptr); + return nativeResponseValue; + } + // void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); + export function ChannelTransactionParameters_set_opt_anchors(this_ptr: number, val: COption_NoneZ): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTransactionParameters_set_opt_anchors(this_ptr, val); + // debug statements here + } + // MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg); + export function ChannelTransactionParameters_new(holder_pubkeys_arg: number, holder_selected_contest_delay_arg: number, is_outbound_from_holder_arg: boolean, counterparty_parameters_arg: number, funding_outpoint_arg: number, opt_anchors_arg: COption_NoneZ): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelTransactionParameters_new(holder_pubkeys_arg, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg, funding_outpoint_arg); + const nativeResponseValue = wasm.ChannelTransactionParameters_new(holder_pubkeys_arg, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg, funding_outpoint_arg, opt_anchors_arg); return nativeResponseValue; } // uint64_t ChannelTransactionParameters_clone_ptr(LDKChannelTransactionParameters *NONNULL_PTR arg); @@ -18035,6 +18438,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.DirectedChannelTransactionParameters_funding_outpoint(this_arg); return nativeResponseValue; } + // MUST_USE_RES bool DirectedChannelTransactionParameters_opt_anchors(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); + export function DirectedChannelTransactionParameters_opt_anchors(this_arg: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.DirectedChannelTransactionParameters_opt_anchors(this_arg); + return nativeResponseValue; + } // void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); export function HolderCommitmentTransaction_free(this_obj: number): void { if(!isWasmInitialized) { @@ -18443,6 +18854,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.TrustedCommitmentTransaction_keys(this_arg); return nativeResponseValue; } + // MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); + export function TrustedCommitmentTransaction_opt_anchors(this_arg: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.TrustedCommitmentTransaction_opt_anchors(this_arg); + return nativeResponseValue; + } // MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); export function TrustedCommitmentTransaction_get_htlc_sigs(this_arg: number, htlc_base_key: Uint8Array, channel_parameters: number): number { if(!isWasmInitialized) { @@ -18491,6 +18910,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InvoiceFeatures_eq(a, b); return nativeResponseValue; } + // bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); + export function ChannelTypeFeatures_eq(a: number, b: number): boolean { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTypeFeatures_eq(a, b); + return nativeResponseValue; + } // uint64_t InitFeatures_clone_ptr(LDKInitFeatures *NONNULL_PTR arg); export function InitFeatures_clone_ptr(arg: number): number { if(!isWasmInitialized) { @@ -18555,6 +18982,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InvoiceFeatures_clone(orig); return nativeResponseValue; } + // uint64_t ChannelTypeFeatures_clone_ptr(LDKChannelTypeFeatures *NONNULL_PTR arg); + export function ChannelTypeFeatures_clone_ptr(arg: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTypeFeatures_clone_ptr(arg); + return nativeResponseValue; + } + // struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); + export function ChannelTypeFeatures_clone(orig: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTypeFeatures_clone(orig); + return nativeResponseValue; + } // void InitFeatures_free(struct LDKInitFeatures this_obj); export function InitFeatures_free(this_obj: number): void { if(!isWasmInitialized) { @@ -18587,6 +19030,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InvoiceFeatures_free(this_obj); // debug statements here } + // void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); + export function ChannelTypeFeatures_free(this_obj: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTypeFeatures_free(this_obj); + // debug statements here + } // MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); export function InitFeatures_empty(): number { if(!isWasmInitialized) { @@ -18683,28 +19134,28 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InvoiceFeatures_requires_unknown_bits(this_arg); return nativeResponseValue; } - // MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); - export function InitFeatures_supports_payment_secret(this_arg: number): boolean { + // MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); + export function ChannelTypeFeatures_empty(): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InitFeatures_supports_payment_secret(this_arg); + const nativeResponseValue = wasm.ChannelTypeFeatures_empty(); return nativeResponseValue; } - // MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); - export function NodeFeatures_supports_payment_secret(this_arg: number): boolean { + // MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_known(void); + export function ChannelTypeFeatures_known(): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeFeatures_supports_payment_secret(this_arg); + const nativeResponseValue = wasm.ChannelTypeFeatures_known(); return nativeResponseValue; } - // MUST_USE_RES bool InvoiceFeatures_supports_payment_secret(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); - export function InvoiceFeatures_supports_payment_secret(this_arg: number): boolean { + // MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + export function ChannelTypeFeatures_requires_unknown_bits(this_arg: number): boolean { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InvoiceFeatures_supports_payment_secret(this_arg); + const nativeResponseValue = wasm.ChannelTypeFeatures_requires_unknown_bits(this_arg); return nativeResponseValue; } // struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); @@ -18715,13 +19166,13 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InitFeatures_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); - export function NodeFeatures_write(obj: number): Uint8Array { + // struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); + export function InitFeatures_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.NodeFeatures_write(obj); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.InitFeatures_read(encodeArray(ser)); + return nativeResponseValue; } // struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); export function ChannelFeatures_write(obj: number): Uint8Array { @@ -18731,21 +19182,21 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelFeatures_write(obj); return decodeArray(nativeResponseValue); } - // struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); - export function InvoiceFeatures_write(obj: number): Uint8Array { + // struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); + export function ChannelFeatures_read(ser: Uint8Array): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InvoiceFeatures_write(obj); - return decodeArray(nativeResponseValue); + const nativeResponseValue = wasm.ChannelFeatures_read(encodeArray(ser)); + return nativeResponseValue; } - // struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); - export function InitFeatures_read(ser: Uint8Array): number { + // struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); + export function NodeFeatures_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.InitFeatures_read(encodeArray(ser)); - return nativeResponseValue; + const nativeResponseValue = wasm.NodeFeatures_write(obj); + return decodeArray(nativeResponseValue); } // struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); export function NodeFeatures_read(ser: Uint8Array): number { @@ -18755,13 +19206,13 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.NodeFeatures_read(encodeArray(ser)); return nativeResponseValue; } - // struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); - export function ChannelFeatures_read(ser: Uint8Array): number { + // struct LDKCVec_u8Z InvoiceFeatures_write(const struct LDKInvoiceFeatures *NONNULL_PTR obj); + export function InvoiceFeatures_write(obj: number): Uint8Array { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ChannelFeatures_read(encodeArray(ser)); - return nativeResponseValue; + const nativeResponseValue = wasm.InvoiceFeatures_write(obj); + return decodeArray(nativeResponseValue); } // struct LDKCResult_InvoiceFeaturesDecodeErrorZ InvoiceFeatures_read(struct LDKu8slice ser); export function InvoiceFeatures_read(ser: Uint8Array): number { @@ -18771,6 +19222,22 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InvoiceFeatures_read(encodeArray(ser)); return nativeResponseValue; } + // struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); + export function ChannelTypeFeatures_write(obj: number): Uint8Array { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTypeFeatures_write(obj); + return decodeArray(nativeResponseValue); + } + // struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); + export function ChannelTypeFeatures_read(ser: Uint8Array): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ChannelTypeFeatures_read(encodeArray(ser)); + return nativeResponseValue; + } // void ShutdownScript_free(struct LDKShutdownScript this_obj); export function ShutdownScript_free(this_obj: number): void { if(!isWasmInitialized) { @@ -18939,38 +19406,6 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.Type_free(this_ptr); // debug statements here } - // void Score_free(struct LDKScore this_ptr); - export function Score_free(this_ptr: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.Score_free(this_ptr); - // debug statements here - } - // void LockableScore_free(struct LDKLockableScore this_obj); - export function LockableScore_free(this_obj: number): void { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.LockableScore_free(this_obj); - // debug statements here - } - // MUST_USE_RES struct LDKLockableScore LockableScore_new(struct LDKScore score); - export function LockableScore_new(score: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.LockableScore_new(score); - return nativeResponseValue; - } - // struct LDKCVec_u8Z LockableScore_write(const struct LDKLockableScore *NONNULL_PTR obj); - export function LockableScore_write(obj: number): Uint8Array { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.LockableScore_write(obj); - return decodeArray(nativeResponseValue); - } // void NodeId_free(struct LDKNodeId this_obj); export function NodeId_free(this_obj: number): void { if(!isWasmInitialized) { @@ -19459,14 +19894,6 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ChannelInfo_set_announcement_message(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKChannelInfo ChannelInfo_new(struct LDKChannelFeatures features_arg, struct LDKNodeId node_one_arg, struct LDKDirectionalChannelInfo one_to_two_arg, struct LDKNodeId node_two_arg, struct LDKDirectionalChannelInfo two_to_one_arg, struct LDKCOption_u64Z capacity_sats_arg, struct LDKChannelAnnouncement announcement_message_arg); - export function ChannelInfo_new(features_arg: number, node_one_arg: number, one_to_two_arg: number, node_two_arg: number, two_to_one_arg: number, capacity_sats_arg: number, announcement_message_arg: number): number { - if(!isWasmInitialized) { - throw new Error("initializeWasm() must be awaited first!"); - } - const nativeResponseValue = wasm.ChannelInfo_new(features_arg, node_one_arg, one_to_two_arg, node_two_arg, two_to_one_arg, capacity_sats_arg, announcement_message_arg); - return nativeResponseValue; - } // uint64_t ChannelInfo_clone_ptr(LDKChannelInfo *NONNULL_PTR arg); export function ChannelInfo_clone_ptr(arg: number): number { if(!isWasmInitialized) { @@ -19899,6 +20326,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.NetworkGraph_fail_node(this_arg, encodeArray(_node_id), is_permanent); // debug statements here } + // void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); + export function NetworkGraph_remove_stale_channels_with_time(this_arg: number, current_time_unix: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.NetworkGraph_remove_stale_channels_with_time(this_arg, current_time_unix); + // debug statements here + } // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); export function NetworkGraph_update_channel(this_arg: number, msg: number): number { if(!isWasmInitialized) { @@ -20683,6 +21118,38 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.find_route(encodeArray(our_node_pubkey), params, network, first_hops, logger, scorer); return nativeResponseValue; } + // void Score_free(struct LDKScore this_ptr); + export function Score_free(this_ptr: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.Score_free(this_ptr); + // debug statements here + } + // void LockableScore_free(struct LDKLockableScore this_ptr); + export function LockableScore_free(this_ptr: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.LockableScore_free(this_ptr); + // debug statements here + } + // void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); + export function MultiThreadedLockableScore_free(this_obj: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.MultiThreadedLockableScore_free(this_obj); + // debug statements here + } + // MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); + export function MultiThreadedLockableScore_new(score: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.MultiThreadedLockableScore_new(score); + return nativeResponseValue; + } // void Scorer_free(struct LDKScorer this_obj); export function Scorer_free(this_obj: number): void { if(!isWasmInitialized) { @@ -20731,6 +21198,38 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ScoringParameters_set_failure_penalty_msat(this_ptr, val); // debug statements here } + // uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + export function ScoringParameters_get_overuse_penalty_start_1024th(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ScoringParameters_get_overuse_penalty_start_1024th(this_ptr); + return nativeResponseValue; + } + // void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val); + export function ScoringParameters_set_overuse_penalty_start_1024th(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ScoringParameters_set_overuse_penalty_start_1024th(this_ptr, val); + // debug statements here + } + // uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); + export function ScoringParameters_get_overuse_penalty_msat_per_1024th(this_ptr: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ScoringParameters_get_overuse_penalty_msat_per_1024th(this_ptr); + return nativeResponseValue; + } + // void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + export function ScoringParameters_set_overuse_penalty_msat_per_1024th(this_ptr: number, val: number): void { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.ScoringParameters_set_overuse_penalty_msat_per_1024th(this_ptr, val); + // debug statements here + } // uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr); export function ScoringParameters_get_failure_penalty_half_life(this_ptr: number): number { if(!isWasmInitialized) { @@ -20747,12 +21246,12 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.ScoringParameters_set_failure_penalty_half_life(this_ptr, val); // debug statements here } - // MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint64_t failure_penalty_half_life_arg); - export function ScoringParameters_new(base_penalty_msat_arg: number, failure_penalty_msat_arg: number, failure_penalty_half_life_arg: number): number { + // MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg); + export function ScoringParameters_new(base_penalty_msat_arg: number, failure_penalty_msat_arg: number, overuse_penalty_start_1024th_arg: number, overuse_penalty_msat_per_1024th_arg: number, failure_penalty_half_life_arg: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); } - const nativeResponseValue = wasm.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); + const nativeResponseValue = wasm.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); return nativeResponseValue; } // struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj); @@ -22019,6 +22518,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.CreationError_expiry_time_out_of_bounds(); return nativeResponseValue; } + // enum LDKCreationError CreationError_invalid_amount(void); + export function CreationError_invalid_amount(): CreationError { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.CreationError_invalid_amount(); + return nativeResponseValue; + } // bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b); export function CreationError_eq(a: number, b: number): boolean { if(!isWasmInitialized) { @@ -22331,7 +22838,7 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.PaymentError_sending(a); return nativeResponseValue; } - // MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts); + // MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts); export function InvoicePayer_new(payer: number, router: number, scorer: number, logger: number, event_handler: number, retry_attempts: number): number { if(!isWasmInitialized) { throw new Error("initializeWasm() must be awaited first!"); @@ -22355,6 +22862,14 @@ public static native long new_empty_slice_vec(); const nativeResponseValue = wasm.InvoicePayer_pay_zero_value_invoice(this_arg, invoice, amount_msats); return nativeResponseValue; } + // MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); + export function InvoicePayer_pay_pubkey(this_arg: number, pubkey: Uint8Array, payment_preimage: Uint8Array, amount_msats: number, final_cltv_expiry_delta: number): number { + if(!isWasmInitialized) { + throw new Error("initializeWasm() must be awaited first!"); + } + const nativeResponseValue = wasm.InvoicePayer_pay_pubkey(this_arg, encodeArray(pubkey), encodeArray(payment_preimage), amount_msats, final_cltv_expiry_delta); + return nativeResponseValue; + } // void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); export function InvoicePayer_remove_cached_payment(this_arg: number, payment_hash: Uint8Array): void { if(!isWasmInitialized) { diff --git a/ts/enums/COption_NoneZ.ts b/ts/enums/COption_NoneZ.ts new file mode 100644 index 00000000..f8ebffce --- /dev/null +++ b/ts/enums/COption_NoneZ.ts @@ -0,0 +1,12 @@ + + export enum COption_NoneZ { + /** + * When we're in this state, this COption_NoneZ contains a + */ +LDKCOption_NoneZ_Some, + /** + * When we're in this state, this COption_NoneZ contains nothing + */ +LDKCOption_NoneZ_None, + + } diff --git a/ts/enums/CreationError.ts b/ts/enums/CreationError.ts index b3ce7f1e..ac012800 100644 --- a/ts/enums/CreationError.ts +++ b/ts/enums/CreationError.ts @@ -16,5 +16,9 @@ LDKCreationError_TimestampOutOfBounds, * The supplied expiry time could cause an overflow if added to a `PositiveTimestamp` */ LDKCreationError_ExpiryTimeOutOfBounds, + /** + * The supplied millisatoshi amount was greater than the total bitcoin supply. + */ +LDKCreationError_InvalidAmount, } diff --git a/ts/enums/Level.ts b/ts/enums/Level.ts index 3c159f7e..0cea0fc5 100644 --- a/ts/enums/Level.ts +++ b/ts/enums/Level.ts @@ -1,6 +1,10 @@ export enum Level { /** + * Designates extremely verbose information, including gossip-induced messages + */ +LDKLevel_Gossip, + /** * Designates very low priority, often extremely verbose, information */ LDKLevel_Trace, diff --git a/ts/structs/ChannelDetails.ts b/ts/structs/ChannelDetails.ts index 333efbe5..15435d95 100644 --- a/ts/structs/ChannelDetails.ts +++ b/ts/structs/ChannelDetails.ts @@ -89,6 +89,15 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelDetails_set_user_channel_id(this.ptr, val); } + public number get_balance_msat() { + number ret = bindings.ChannelDetails_get_balance_msat(this.ptr); + return ret; + } + + public void set_balance_msat(number val) { + bindings.ChannelDetails_set_balance_msat(this.ptr, val); + } + public number get_outbound_capacity_msat() { number ret = bindings.ChannelDetails_get_outbound_capacity_msat(this.ptr); return ret; @@ -165,8 +174,8 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelDetails_set_is_public(this.ptr, val); } - public static ChannelDetails constructor_new(Uint8Array channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, number channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, number user_channel_id_arg, number outbound_capacity_msat_arg, number inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) { - number ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, short_channel_id_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); + public static ChannelDetails constructor_new(Uint8Array channel_id_arg, ChannelCounterparty counterparty_arg, OutPoint funding_txo_arg, Option_u64Z short_channel_id_arg, number channel_value_satoshis_arg, Option_u64Z unspendable_punishment_reserve_arg, number user_channel_id_arg, number balance_msat_arg, number outbound_capacity_msat_arg, number inbound_capacity_msat_arg, Option_u32Z confirmations_required_arg, Option_u16Z force_close_spend_delay_arg, boolean is_outbound_arg, boolean is_funding_locked_arg, boolean is_usable_arg, boolean is_public_arg) { + number ret = bindings.ChannelDetails_new(InternalUtils.check_arr_len(channel_id_arg, 32), counterparty_arg == null ? 0 : counterparty_arg.ptr & ~1, funding_txo_arg == null ? 0 : funding_txo_arg.ptr & ~1, short_channel_id_arg.ptr, channel_value_satoshis_arg, unspendable_punishment_reserve_arg.ptr, user_channel_id_arg, balance_msat_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg.ptr, force_close_spend_delay_arg.ptr, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg); const ret_hu_conv: ChannelDetails = new ChannelDetails(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/ChannelInfo.ts b/ts/structs/ChannelInfo.ts index 0101375d..19a18379 100644 --- a/ts/structs/ChannelInfo.ts +++ b/ts/structs/ChannelInfo.ts @@ -95,13 +95,6 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelInfo_set_announcement_message(this.ptr, val == null ? 0 : val.ptr & ~1); } - public static ChannelInfo constructor_new(ChannelFeatures features_arg, NodeId node_one_arg, DirectionalChannelInfo one_to_two_arg, NodeId node_two_arg, DirectionalChannelInfo two_to_one_arg, Option_u64Z capacity_sats_arg, ChannelAnnouncement announcement_message_arg) { - number ret = bindings.ChannelInfo_new(features_arg == null ? 0 : features_arg.ptr & ~1, node_one_arg == null ? 0 : node_one_arg.ptr & ~1, one_to_two_arg == null ? 0 : one_to_two_arg.ptr & ~1, node_two_arg == null ? 0 : node_two_arg.ptr & ~1, two_to_one_arg == null ? 0 : two_to_one_arg.ptr & ~1, capacity_sats_arg.ptr, announcement_message_arg == null ? 0 : announcement_message_arg.ptr & ~1); - const ret_hu_conv: ChannelInfo = new ChannelInfo(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - public number clone_ptr() { number ret = bindings.ChannelInfo_clone_ptr(this.ptr); return ret; diff --git a/ts/structs/ChannelManager.ts b/ts/structs/ChannelManager.ts index b99a3cba..5c483a3d 100644 --- a/ts/structs/ChannelManager.ts +++ b/ts/structs/ChannelManager.ts @@ -103,6 +103,10 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public void abandon_payment(Uint8Array payment_id) { + bindings.ChannelManager_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32)); + } + public Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ send_spontaneous_payment(Route route, Uint8Array payment_preimage) { number ret = bindings.ChannelManager_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_preimage, 32)); Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.constr_from_ptr(ret); @@ -143,19 +147,36 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public TwoTuple_PaymentHashPaymentSecretZ create_inbound_payment(Option_u64Z min_value_msat, number invoice_expiry_delta_secs, number user_payment_id) { - number ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, user_payment_id); - TwoTuple_PaymentHashPaymentSecretZ ret_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, ret); - ret_hu_conv.ptrs_to.add(this); + public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create_inbound_payment(Option_u64Z min_value_msat, number invoice_expiry_delta_secs) { + number ret = bindings.ChannelManager_create_inbound_payment(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs); + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ create_inbound_payment_legacy(Option_u64Z min_value_msat, number invoice_expiry_delta_secs) { + number ret = bindings.ChannelManager_create_inbound_payment_legacy(this.ptr, min_value_msat.ptr, invoice_expiry_delta_secs); + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; } - public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash(Uint8Array payment_hash, Option_u64Z min_value_msat, number invoice_expiry_delta_secs, number user_payment_id) { - number ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs, user_payment_id); + public Result_PaymentSecretNoneZ create_inbound_payment_for_hash(Uint8Array payment_hash, Option_u64Z min_value_msat, number invoice_expiry_delta_secs) { + number ret = bindings.ChannelManager_create_inbound_payment_for_hash(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs); + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_PaymentSecretAPIErrorZ create_inbound_payment_for_hash_legacy(Uint8Array payment_hash, Option_u64Z min_value_msat, number invoice_expiry_delta_secs) { + number ret = bindings.ChannelManager_create_inbound_payment_for_hash_legacy(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), min_value_msat.ptr, invoice_expiry_delta_secs); Result_PaymentSecretAPIErrorZ ret_hu_conv = Result_PaymentSecretAPIErrorZ.constr_from_ptr(ret); return ret_hu_conv; } + public Result_PaymentPreimageAPIErrorZ get_payment_preimage(Uint8Array payment_hash, Uint8Array payment_secret) { + number ret = bindings.ChannelManager_get_payment_preimage(this.ptr, InternalUtils.check_arr_len(payment_hash, 32), InternalUtils.check_arr_len(payment_secret, 32)); + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + public MessageSendEventsProvider as_MessageSendEventsProvider() { number ret = bindings.ChannelManager_as_MessageSendEventsProvider(this.ptr); MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret); diff --git a/ts/structs/ChannelMonitor.ts b/ts/structs/ChannelMonitor.ts index d0c4a00d..e88b8b46 100644 --- a/ts/structs/ChannelMonitor.ts +++ b/ts/structs/ChannelMonitor.ts @@ -35,9 +35,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public Result_NoneMonitorUpdateErrorZ update_monitor(ChannelMonitorUpdate updates, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { + public Result_NoneNoneZ update_monitor(ChannelMonitorUpdate updates, BroadcasterInterface broadcaster, FeeEstimator fee_estimator, Logger logger) { number ret = bindings.ChannelMonitor_update_monitor(this.ptr, updates == null ? 0 : updates.ptr & ~1, broadcaster == null ? 0 : broadcaster.ptr, fee_estimator == null ? 0 : fee_estimator.ptr, logger == null ? 0 : logger.ptr); - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); + Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret); this.ptrs_to.add(updates); this.ptrs_to.add(broadcaster); this.ptrs_to.add(fee_estimator); diff --git a/ts/structs/ChannelTransactionParameters.ts b/ts/structs/ChannelTransactionParameters.ts index 7efbc0cf..8b49117e 100644 --- a/ts/structs/ChannelTransactionParameters.ts +++ b/ts/structs/ChannelTransactionParameters.ts @@ -69,8 +69,17 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1); } - public static ChannelTransactionParameters constructor_new(ChannelPublicKeys holder_pubkeys_arg, number holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg) { - number ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1); + public COption_NoneZ get_opt_anchors() { + COption_NoneZ ret = bindings.ChannelTransactionParameters_get_opt_anchors(this.ptr); + return ret; + } + + public void set_opt_anchors(COption_NoneZ val) { + bindings.ChannelTransactionParameters_set_opt_anchors(this.ptr, val); + } + + public static ChannelTransactionParameters constructor_new(ChannelPublicKeys holder_pubkeys_arg, number holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg, COption_NoneZ opt_anchors_arg) { + number ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1, opt_anchors_arg); const ret_hu_conv: ChannelTransactionParameters = new ChannelTransactionParameters(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/ChannelTypeFeatures.ts b/ts/structs/ChannelTypeFeatures.ts new file mode 100644 index 00000000..6863dec4 --- /dev/null +++ b/ts/structs/ChannelTypeFeatures.ts @@ -0,0 +1,69 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class ChannelTypeFeatures extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.ChannelTypeFeatures_free(this.ptr); + } + } + public boolean eq(ChannelTypeFeatures b) { + boolean ret = bindings.ChannelTypeFeatures_eq(this.ptr, b == null ? 0 : b.ptr & ~1); + this.ptrs_to.add(b); + return ret; + } + + public number clone_ptr() { + number ret = bindings.ChannelTypeFeatures_clone_ptr(this.ptr); + return ret; + } + + public ChannelTypeFeatures clone() { + number ret = bindings.ChannelTypeFeatures_clone(this.ptr); + const ret_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public static ChannelTypeFeatures constructor_empty() { + number ret = bindings.ChannelTypeFeatures_empty(); + const ret_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public static ChannelTypeFeatures constructor_known() { + number ret = bindings.ChannelTypeFeatures_known(); + const ret_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + + public boolean requires_unknown_bits() { + boolean ret = bindings.ChannelTypeFeatures_requires_unknown_bits(this.ptr); + return ret; + } + + public Uint8Array write() { + Uint8Array ret = bindings.ChannelTypeFeatures_write(this.ptr); + return ret; + } + + public static Result_ChannelTypeFeaturesDecodeErrorZ constructor_read(Uint8Array ser) { + number ret = bindings.ChannelTypeFeatures_read(ser); + Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/ClosureReason.ts b/ts/structs/ClosureReason.ts index b75406c7..fab6ef68 100644 --- a/ts/structs/ClosureReason.ts +++ b/ts/structs/ClosureReason.ts @@ -22,6 +22,9 @@ export default class ClosureReason extends CommonBase { if (raw_val instanceof bindings.LDKClosureReason.CommitmentTxConfirmed) { return new CommitmentTxConfirmed(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKClosureReason.FundingTimedOut) { + return new FundingTimedOut(this.ptr, raw_val); + } if (raw_val instanceof bindings.LDKClosureReason.ProcessingError) { return new ProcessingError(this.ptr, raw_val); } @@ -57,6 +60,11 @@ export class CommitmentTxConfirmed extends ClosureReason { super(null, ptr); } } +export class FundingTimedOut extends ClosureReason { + private constructor(ptr: number, obj: bindings.LDKClosureReason.FundingTimedOut) { + super(null, ptr); + } +} export class ProcessingError extends ClosureReason { public err: String; private constructor(ptr: number, obj: bindings.LDKClosureReason.ProcessingError) { @@ -114,6 +122,13 @@ export class OutdatedChannelManager extends ClosureReason { return ret_hu_conv; } + public static ClosureReason constructor_funding_timed_out() { + number ret = bindings.ClosureReason_funding_timed_out(); + ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + public static ClosureReason constructor_processing_error(String err) { number ret = bindings.ClosureReason_processing_error(err); ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret); diff --git a/ts/structs/DirectedChannelTransactionParameters.ts b/ts/structs/DirectedChannelTransactionParameters.ts index 77c53071..dfc9e696 100644 --- a/ts/structs/DirectedChannelTransactionParameters.ts +++ b/ts/structs/DirectedChannelTransactionParameters.ts @@ -49,4 +49,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public boolean opt_anchors() { + boolean ret = bindings.DirectedChannelTransactionParameters_opt_anchors(this.ptr); + return ret; + } + } diff --git a/ts/structs/ErrorAction.ts b/ts/structs/ErrorAction.ts index ff12a1de..64eea7a0 100644 --- a/ts/structs/ErrorAction.ts +++ b/ts/structs/ErrorAction.ts @@ -19,6 +19,9 @@ export default class ErrorAction extends CommonBase { if (raw_val instanceof bindings.LDKErrorAction.IgnoreAndLog) { return new IgnoreAndLog(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKErrorAction.IgnoreDuplicateGossip) { + return new IgnoreDuplicateGossip(this.ptr, raw_val); + } if (raw_val instanceof bindings.LDKErrorAction.SendErrorMessage) { return new SendErrorMessage(this.ptr, raw_val); } @@ -48,6 +51,11 @@ export class IgnoreAndLog extends ErrorAction { this.ignore_and_log = obj.ignore_and_log; } } +export class IgnoreDuplicateGossip extends ErrorAction { + private constructor(ptr: number, obj: bindings.LDKErrorAction.IgnoreDuplicateGossip) { + super(null, ptr); + } +} export class SendErrorMessage extends ErrorAction { public msg: ErrorMessage; private constructor(ptr: number, obj: bindings.LDKErrorAction.SendErrorMessage) { @@ -91,6 +99,13 @@ export class SendErrorMessage extends ErrorAction { return ret_hu_conv; } + public static ErrorAction constructor_ignore_duplicate_gossip() { + number ret = bindings.ErrorAction_ignore_duplicate_gossip(); + ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + public static ErrorAction constructor_send_error_message(ErrorMessage msg) { number ret = bindings.ErrorAction_send_error_message(msg == null ? 0 : msg.ptr & ~1); ErrorAction ret_hu_conv = ErrorAction.constr_from_ptr(ret); diff --git a/ts/structs/Event.ts b/ts/structs/Event.ts index 022a0b5c..a21ecbf3 100644 --- a/ts/structs/Event.ts +++ b/ts/structs/Event.ts @@ -22,6 +22,9 @@ export default class Event extends CommonBase { if (raw_val instanceof bindings.LDKEvent.PaymentPathFailed) { return new PaymentPathFailed(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKEvent.PaymentFailed) { + return new PaymentFailed(this.ptr, raw_val); + } if (raw_val instanceof bindings.LDKEvent.PendingHTLCsForwardable) { return new PendingHTLCsForwardable(this.ptr, raw_val); } @@ -37,6 +40,9 @@ export default class Event extends CommonBase { if (raw_val instanceof bindings.LDKEvent.DiscardFunding) { return new DiscardFunding(this.ptr, raw_val); } + if (raw_val instanceof bindings.LDKEvent.PaymentPathSuccessful) { + return new PaymentPathSuccessful(this.ptr, raw_val); + } throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface } @@ -122,6 +128,15 @@ export class PaymentPathFailed extends Event { this.retry = retry_hu_conv; } } +export class PaymentFailed extends Event { + public payment_id: Uint8Array; + public payment_hash: Uint8Array; + private constructor(ptr: number, obj: bindings.LDKEvent.PaymentFailed) { + super(null, ptr); + this.payment_id = obj.payment_id; + this.payment_hash = obj.payment_hash; + } +} export class PendingHTLCsForwardable extends Event { public time_forwardable: number; private constructor(ptr: number, obj: bindings.LDKEvent.PendingHTLCsForwardable) { @@ -178,6 +193,25 @@ export class DiscardFunding extends Event { this.channel_id = obj.channel_id; this.transaction = obj.transaction; } +} +export class PaymentPathSuccessful extends Event { + public payment_id: Uint8Array; + public payment_hash: Uint8Array; + public path: RouteHop[]; + private constructor(ptr: number, obj: bindings.LDKEvent.PaymentPathSuccessful) { + super(null, ptr); + this.payment_id = obj.payment_id; + this.payment_hash = obj.payment_hash; + const path: number[] = obj.path; + RouteHop[] path_conv_10_arr = new RouteHop[path.length]; + for (int k = 0; k < path.length; k++) { + number path_conv_10 = path[k]; + const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10); + path_conv_10_hu_conv.ptrs_to.add(this); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + this.path = path_conv_10_arr; + } } public number clone_ptr() { number ret = bindings.Event_clone_ptr(this.ptr); @@ -219,6 +253,13 @@ export class DiscardFunding extends Event { return ret_hu_conv; } + public static Event constructor_payment_failed(Uint8Array payment_id, Uint8Array payment_hash) { + number ret = bindings.Event_payment_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32)); + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + public static Event constructor_pending_htlcs_forwardable(number time_forwardable) { number ret = bindings.Event_pending_htlcs_forwardable(time_forwardable); Event ret_hu_conv = Event.constr_from_ptr(ret); @@ -254,6 +295,13 @@ export class DiscardFunding extends Event { return ret_hu_conv; } + public static Event constructor_payment_path_successful(Uint8Array payment_id, Uint8Array payment_hash, RouteHop[] path) { + number ret = bindings.Event_payment_path_successful(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null); + Event ret_hu_conv = Event.constr_from_ptr(ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + return ret_hu_conv; + } + public Uint8Array write() { Uint8Array ret = bindings.Event_write(this.ptr); return ret; diff --git a/ts/structs/InMemorySigner.ts b/ts/structs/InMemorySigner.ts index 767957f2..ff323bb4 100644 --- a/ts/structs/InMemorySigner.ts +++ b/ts/structs/InMemorySigner.ts @@ -127,6 +127,11 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public boolean opt_anchors() { + boolean ret = bindings.InMemorySigner_opt_anchors(this.ptr); + return ret; + } + public Result_CVec_CVec_u8ZZNoneZ sign_counterparty_payment_input(Uint8Array spend_tx, number input_idx, StaticPaymentOutputDescriptor descriptor) { number ret = bindings.InMemorySigner_sign_counterparty_payment_input(this.ptr, spend_tx, input_idx, descriptor == null ? 0 : descriptor.ptr & ~1); Result_CVec_CVec_u8ZZNoneZ ret_hu_conv = Result_CVec_CVec_u8ZZNoneZ.constr_from_ptr(ret); diff --git a/ts/structs/InitFeatures.ts b/ts/structs/InitFeatures.ts index 387c4a30..ca4e1c39 100644 --- a/ts/structs/InitFeatures.ts +++ b/ts/structs/InitFeatures.ts @@ -55,11 +55,6 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public boolean supports_payment_secret() { - boolean ret = bindings.InitFeatures_supports_payment_secret(this.ptr); - return ret; - } - public Uint8Array write() { Uint8Array ret = bindings.InitFeatures_write(this.ptr); return ret; diff --git a/ts/structs/InvoiceFeatures.ts b/ts/structs/InvoiceFeatures.ts index 109957b1..a184d7bd 100644 --- a/ts/structs/InvoiceFeatures.ts +++ b/ts/structs/InvoiceFeatures.ts @@ -55,11 +55,6 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public boolean supports_payment_secret() { - boolean ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr); - return ret; - } - public Uint8Array write() { Uint8Array ret = bindings.InvoiceFeatures_write(this.ptr); return ret; diff --git a/ts/structs/InvoicePayer.ts b/ts/structs/InvoicePayer.ts index fcccc6c8..a656a817 100644 --- a/ts/structs/InvoicePayer.ts +++ b/ts/structs/InvoicePayer.ts @@ -18,7 +18,7 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.InvoicePayer_free(this.ptr); } } - public static InvoicePayer constructor_new(Payer payer, Router router, LockableScore scorer, Logger logger, EventHandler event_handler, RetryAttempts retry_attempts) { + public static InvoicePayer constructor_new(Payer payer, Router router, MultiThreadedLockableScore scorer, Logger logger, EventHandler event_handler, RetryAttempts retry_attempts) { number ret = bindings.InvoicePayer_new(payer == null ? 0 : payer.ptr, router == null ? 0 : router.ptr, scorer == null ? 0 : scorer.ptr & ~1, logger == null ? 0 : logger.ptr, event_handler == null ? 0 : event_handler.ptr, retry_attempts == null ? 0 : retry_attempts.ptr & ~1); const ret_hu_conv: InvoicePayer = new InvoicePayer(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); @@ -44,6 +44,12 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public Result_PaymentIdPaymentErrorZ pay_pubkey(Uint8Array pubkey, Uint8Array payment_preimage, number amount_msats, number final_cltv_expiry_delta) { + number ret = bindings.InvoicePayer_pay_pubkey(this.ptr, InternalUtils.check_arr_len(pubkey, 33), InternalUtils.check_arr_len(payment_preimage, 32), amount_msats, final_cltv_expiry_delta); + Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + public void remove_cached_payment(Uint8Array payment_hash) { bindings.InvoicePayer_remove_cached_payment(this.ptr, InternalUtils.check_arr_len(payment_hash, 32)); } diff --git a/ts/structs/KeysInterface.ts b/ts/structs/KeysInterface.ts index 46543e46..bfc1777f 100644 --- a/ts/structs/KeysInterface.ts +++ b/ts/structs/KeysInterface.ts @@ -74,6 +74,12 @@ import * as bindings from '../bindings' // TODO: figure out location return result; }, + get_inbound_payment_key_material (): Uint8Array { + Uint8Array ret = arg.get_inbound_payment_key_material(); + result: Uint8Array = InternalUtils.check_arr_len(ret, 32); + return result; + }, + }; impl_holder.held = new KeysInterface (null, structImplementation); @@ -88,6 +94,7 @@ import * as bindings from '../bindings' // TODO: figure out location get_secure_random_bytes(): Uint8Array; read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ; sign_invoice(invoice_preimage: Uint8Array): Result_RecoverableSignatureNoneZ; + get_inbound_payment_key_material(): Uint8Array; } @@ -135,4 +142,9 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public Uint8Array get_inbound_payment_key_material() { + Uint8Array ret = bindings.KeysInterface_get_inbound_payment_key_material(this.ptr); + return ret; + } + } diff --git a/ts/structs/LockableScore.ts b/ts/structs/LockableScore.ts index 8eef837f..bc44054d 100644 --- a/ts/structs/LockableScore.ts +++ b/ts/structs/LockableScore.ts @@ -5,30 +5,59 @@ import * as bindings from '../bindings' // TODO: figure out location - export default class LockableScore extends CommonBase { - constructor(_dummy: object, ptr: number) { - super(ptr); + export class LockableScore extends CommonBase { + + bindings_instance?: bindings.LDKLockableScore; + + constructor(ptr?: number, arg?: bindings.LDKLockableScore) { + if (Number.isFinite(ptr)) { + super(ptr); + this.bindings_instance = null; + } else { + // TODO: private constructor instantiation + super(bindings.LDKLockableScore_new(arg)); + this.ptrs_to.push(arg); + + } } - protected finalize() { - super.finalize(); - if (this.ptr != 0) { bindings.LockableScore_free(this.ptr); } + super.finalize(); } - public static LockableScore constructor_new(Score score) { - number ret = bindings.LockableScore_new(score == null ? 0 : score.ptr); - const ret_hu_conv: LockableScore = new LockableScore(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - ret_hu_conv.ptrs_to.add(score); - return ret_hu_conv; - } - public Uint8Array write() { - Uint8Array ret = bindings.LockableScore_write(this.ptr); - return ret; + static new_impl(arg: LockableScoreInterface): LockableScore { + const impl_holder: LDKLockableScoreHolder = new LDKLockableScoreHolder(); + let structImplementation = { + // todo: in-line interface filling + lock (): number { + Score ret = arg.lock(); + result: number = ret == null ? 0 : ret.ptr; + impl_holder.held.ptrs_to.add(ret); + return result; + }, + + + }; + impl_holder.held = new LockableScore (null, structImplementation); + } + } + + export interface LockableScoreInterface { + lock(): Score; + + } + + class LDKLockableScoreHolder { + held: LockableScore; + } + public Score lock() { + number ret = bindings.LockableScore_lock(this.ptr); + Score ret_hu_conv = new Score(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } } diff --git a/ts/structs/MonitorUpdateError.ts b/ts/structs/MonitorUpdateError.ts deleted file mode 100644 index 662021c1..00000000 --- a/ts/structs/MonitorUpdateError.ts +++ /dev/null @@ -1,49 +0,0 @@ - - -import CommonBase from './CommonBase'; -import * as bindings from '../bindings' // TODO: figure out location - - - - export default class MonitorUpdateError extends CommonBase { - constructor(_dummy: object, ptr: number) { - super(ptr); - } - - - protected finalize() { - super.finalize(); - - if (this.ptr != 0) { - bindings.MonitorUpdateError_free(this.ptr); - } - } - public String get_a() { - String ret = bindings.MonitorUpdateError_get_a(this.ptr); - return ret; - } - - public void set_a(String val) { - bindings.MonitorUpdateError_set_a(this.ptr, val); - } - - public static MonitorUpdateError constructor_new(String a_arg) { - number ret = bindings.MonitorUpdateError_new(a_arg); - const ret_hu_conv: MonitorUpdateError = new MonitorUpdateError(null, ret); - ret_hu_conv.ptrs_to.add(ret_hu_conv); - return ret_hu_conv; - } - - public number clone_ptr() { - number ret = bindings.MonitorUpdateError_clone_ptr(this.ptr); - return ret; - } - - public MonitorUpdateError clone() { - number ret = bindings.MonitorUpdateError_clone(this.ptr); - const ret_hu_conv: MonitorUpdateError = new MonitorUpdateError(null, ret); - ret_hu_conv.ptrs_to.add(this); - return ret_hu_conv; - } - -} diff --git a/ts/structs/MultiThreadedLockableScore.ts b/ts/structs/MultiThreadedLockableScore.ts new file mode 100644 index 00000000..07ea9992 --- /dev/null +++ b/ts/structs/MultiThreadedLockableScore.ts @@ -0,0 +1,29 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export default class MultiThreadedLockableScore extends CommonBase { + constructor(_dummy: object, ptr: number) { + super(ptr); + } + + + protected finalize() { + super.finalize(); + + if (this.ptr != 0) { + bindings.MultiThreadedLockableScore_free(this.ptr); + } + } + public static MultiThreadedLockableScore constructor_new(Score score) { + number ret = bindings.MultiThreadedLockableScore_new(score == null ? 0 : score.ptr); + const ret_hu_conv: MultiThreadedLockableScore = new MultiThreadedLockableScore(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(score); + return ret_hu_conv; + } + +} diff --git a/ts/structs/NetAddress.ts b/ts/structs/NetAddress.ts index 2910201a..d80b5189 100644 --- a/ts/structs/NetAddress.ts +++ b/ts/structs/NetAddress.ts @@ -45,12 +45,10 @@ export class IPv6 extends NetAddress { } } export class OnionV2 extends NetAddress { - public addr: Uint8Array; - public port: number; + public onion_v2: Uint8Array; private constructor(ptr: number, obj: bindings.LDKNetAddress.OnionV2) { super(null, ptr); - this.addr = obj.addr; - this.port = obj.port; + this.onion_v2 = obj.onion_v2; } } export class OnionV3 extends NetAddress { @@ -92,8 +90,8 @@ export class OnionV3 extends NetAddress { return ret_hu_conv; } - public static NetAddress constructor_onion_v2(Uint8Array addr, number port) { - number ret = bindings.NetAddress_onion_v2(InternalUtils.check_arr_len(addr, 10), port); + public static NetAddress constructor_onion_v2(Uint8Array a) { + number ret = bindings.NetAddress_onion_v2(InternalUtils.check_arr_len(a, 12)); NetAddress ret_hu_conv = NetAddress.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/NetworkGraph.ts b/ts/structs/NetworkGraph.ts index e2c2a6f8..4f33d5f8 100644 --- a/ts/structs/NetworkGraph.ts +++ b/ts/structs/NetworkGraph.ts @@ -93,6 +93,10 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.NetworkGraph_fail_node(this.ptr, InternalUtils.check_arr_len(_node_id, 33), is_permanent); } + public void remove_stale_channels_with_time(number current_time_unix) { + bindings.NetworkGraph_remove_stale_channels_with_time(this.ptr, current_time_unix); + } + public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) { number ret = bindings.NetworkGraph_update_channel(this.ptr, msg == null ? 0 : msg.ptr & ~1); Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); diff --git a/ts/structs/NodeFeatures.ts b/ts/structs/NodeFeatures.ts index 96f6e286..f9a4c13a 100644 --- a/ts/structs/NodeFeatures.ts +++ b/ts/structs/NodeFeatures.ts @@ -55,11 +55,6 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public boolean supports_payment_secret() { - boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr); - return ret; - } - public Uint8Array write() { Uint8Array ret = bindings.NodeFeatures_write(this.ptr); return ret; diff --git a/ts/structs/OpenChannel.ts b/ts/structs/OpenChannel.ts index 6a62b836..8088f78d 100644 --- a/ts/structs/OpenChannel.ts +++ b/ts/structs/OpenChannel.ts @@ -180,6 +180,17 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.OpenChannel_set_channel_flags(this.ptr, val); } + public ChannelTypeFeatures get_channel_type() { + number ret = bindings.OpenChannel_get_channel_type(this.ptr); + const ret_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + public void set_channel_type(ChannelTypeFeatures val) { + bindings.OpenChannel_set_channel_type(this.ptr, val == null ? 0 : val.ptr & ~1); + } + public number clone_ptr() { number ret = bindings.OpenChannel_clone_ptr(this.ptr); return ret; diff --git a/ts/structs/Payer.ts b/ts/structs/Payer.ts index 1e815cb1..cab53970 100644 --- a/ts/structs/Payer.ts +++ b/ts/structs/Payer.ts @@ -51,6 +51,13 @@ import * as bindings from '../bindings' // TODO: figure out location return result; }, + send_spontaneous_payment (route: number, payment_preimage: Uint8Array): number { + const route_hu_conv: Route = new Route(null, route); + Result_PaymentIdPaymentSendFailureZ ret = arg.send_spontaneous_payment(route_hu_conv, payment_preimage); + result: number = ret == null ? 0 : ret.clone_ptr(); + return result; + }, + retry_payment (route: number, payment_id: Uint8Array): number { const route_hu_conv: Route = new Route(null, route); Result_NonePaymentSendFailureZ ret = arg.retry_payment(route_hu_conv, payment_id); @@ -58,6 +65,10 @@ import * as bindings from '../bindings' // TODO: figure out location return result; }, + abandon_payment (payment_id: Uint8Array): void { + arg.abandon_payment(payment_id); + }, + }; impl_holder.held = new Payer (null, structImplementation); @@ -68,7 +79,9 @@ import * as bindings from '../bindings' // TODO: figure out location node_id(): Uint8Array; first_hops(): ChannelDetails[]; send_payment(route: Route, payment_hash: Uint8Array, payment_secret: Uint8Array): Result_PaymentIdPaymentSendFailureZ; + send_spontaneous_payment(route: Route, payment_preimage: Uint8Array): Result_PaymentIdPaymentSendFailureZ; retry_payment(route: Route, payment_id: Uint8Array): Result_NonePaymentSendFailureZ; + abandon_payment(payment_id: Uint8Array): void; } @@ -99,6 +112,13 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public Result_PaymentIdPaymentSendFailureZ send_spontaneous_payment(Route route, Uint8Array payment_preimage) { + number ret = bindings.Payer_send_spontaneous_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_preimage, 32)); + Result_PaymentIdPaymentSendFailureZ ret_hu_conv = Result_PaymentIdPaymentSendFailureZ.constr_from_ptr(ret); + this.ptrs_to.add(route); + return ret_hu_conv; + } + public Result_NonePaymentSendFailureZ retry_payment(Route route, Uint8Array payment_id) { number ret = bindings.Payer_retry_payment(this.ptr, route == null ? 0 : route.ptr & ~1, InternalUtils.check_arr_len(payment_id, 32)); Result_NonePaymentSendFailureZ ret_hu_conv = Result_NonePaymentSendFailureZ.constr_from_ptr(ret); @@ -106,4 +126,8 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public void abandon_payment(Uint8Array payment_id) { + bindings.Payer_abandon_payment(this.ptr, InternalUtils.check_arr_len(payment_id, 32)); + } + } diff --git a/ts/structs/PaymentPurpose.ts b/ts/structs/PaymentPurpose.ts index 163b6028..a71834b7 100644 --- a/ts/structs/PaymentPurpose.ts +++ b/ts/structs/PaymentPurpose.ts @@ -23,12 +23,10 @@ export default class PaymentPurpose extends CommonBase { export class InvoicePayment extends PaymentPurpose { public payment_preimage: Uint8Array; public payment_secret: Uint8Array; - public user_payment_id: number; private constructor(ptr: number, obj: bindings.LDKPaymentPurpose.InvoicePayment) { super(null, ptr); this.payment_preimage = obj.payment_preimage; this.payment_secret = obj.payment_secret; - this.user_payment_id = obj.user_payment_id; } } export class SpontaneousPayment extends PaymentPurpose { @@ -50,8 +48,8 @@ export class SpontaneousPayment extends PaymentPurpose { return ret_hu_conv; } - public static PaymentPurpose constructor_invoice_payment(Uint8Array payment_preimage, Uint8Array payment_secret, number user_payment_id) { - number ret = bindings.PaymentPurpose_invoice_payment(InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_secret, 32), user_payment_id); + public static PaymentPurpose constructor_invoice_payment(Uint8Array payment_preimage, Uint8Array payment_secret) { + number ret = bindings.PaymentPurpose_invoice_payment(InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_secret, 32)); PaymentPurpose ret_hu_conv = PaymentPurpose.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.ts b/ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.ts new file mode 100644 index 00000000..26e3a960 --- /dev/null +++ b/ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.ts @@ -0,0 +1,68 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ extends CommonBase { + private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(ptr); } super.finalize(); + } + + static Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(ptr)) { + return new Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_OK(null, ptr); + } else { + return new Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err(null, ptr); + } + } + public static final class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_OK extends Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { + public final TwoTuple_PaymentHashPaymentSecretZ res; + private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_ok(ptr); + TwoTuple_PaymentHashPaymentSecretZ res_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err extends Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { + public final APIError err; + private Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_get_err(ptr); + APIError err_hu_conv = APIError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ constructor_ok(TwoTuple_PaymentHashPaymentSecretZ o) { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(o != null ? o.ptr : 0); + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ constructor_err(APIError e) { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(e.ptr); + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public boolean is_ok() { + boolean ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(this.ptr); + return ret; + } + + public number clone_ptr() { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone_ptr(this.ptr); + return ret; + } + + public Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ clone() { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(this.ptr); + Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.ts b/ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.ts new file mode 100644 index 00000000..290ae959 --- /dev/null +++ b/ts/structs/Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.ts @@ -0,0 +1,63 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_C2Tuple_PaymentHashPaymentSecretZNoneZ extends CommonBase { + private Result_C2Tuple_PaymentHashPaymentSecretZNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(ptr); } super.finalize(); + } + + static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ constr_from_ptr(long ptr) { + if (bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(ptr)) { + return new Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_OK(null, ptr); + } else { + return new Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_Err(null, ptr); + } + } + public static final class Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_OK extends Result_C2Tuple_PaymentHashPaymentSecretZNoneZ { + public final TwoTuple_PaymentHashPaymentSecretZ res; + private Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_get_ok(ptr); + TwoTuple_PaymentHashPaymentSecretZ res_hu_conv = new TwoTuple_PaymentHashPaymentSecretZ(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_Err extends Result_C2Tuple_PaymentHashPaymentSecretZNoneZ { + private Result_C2Tuple_PaymentHashPaymentSecretZNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ constructor_ok(TwoTuple_PaymentHashPaymentSecretZ o) { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(o != null ? o.ptr : 0); + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ constructor_err() { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(); + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public boolean is_ok() { + boolean ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(this.ptr); + return ret; + } + + public number clone_ptr() { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone_ptr(this.ptr); + return ret; + } + + public Result_C2Tuple_PaymentHashPaymentSecretZNoneZ clone() { + number ret = bindings.CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(this.ptr); + Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_ChannelTypeFeaturesDecodeErrorZ.ts b/ts/structs/Result_ChannelTypeFeaturesDecodeErrorZ.ts new file mode 100644 index 00000000..5a202a52 --- /dev/null +++ b/ts/structs/Result_ChannelTypeFeaturesDecodeErrorZ.ts @@ -0,0 +1,57 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_ChannelTypeFeaturesDecodeErrorZ extends CommonBase { + private Result_ChannelTypeFeaturesDecodeErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_free(ptr); } super.finalize(); + } + + static Result_ChannelTypeFeaturesDecodeErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(ptr)) { + return new Result_ChannelTypeFeaturesDecodeErrorZ_OK(null, ptr); + } else { + return new Result_ChannelTypeFeaturesDecodeErrorZ_Err(null, ptr); + } + } + public static final class Result_ChannelTypeFeaturesDecodeErrorZ_OK extends Result_ChannelTypeFeaturesDecodeErrorZ { + public final ChannelTypeFeatures res; + private Result_ChannelTypeFeaturesDecodeErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + number res = bindings.LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_ok(ptr); + const res_hu_conv: ChannelTypeFeatures = new ChannelTypeFeatures(null, res); + res_hu_conv.ptrs_to.add(this); + this.res = res_hu_conv; + } + } + + public static final class Result_ChannelTypeFeaturesDecodeErrorZ_Err extends Result_ChannelTypeFeaturesDecodeErrorZ { + public final DecodeError err; + private Result_ChannelTypeFeaturesDecodeErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_ChannelTypeFeaturesDecodeErrorZ_get_err(ptr); + const err_hu_conv: DecodeError = new DecodeError(null, err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_ChannelTypeFeaturesDecodeErrorZ constructor_ok(ChannelTypeFeatures o) { + number ret = bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1); + Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_ChannelTypeFeaturesDecodeErrorZ constructor_err(DecodeError e) { + number ret = bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1); + Result_ChannelTypeFeaturesDecodeErrorZ ret_hu_conv = Result_ChannelTypeFeaturesDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public boolean is_ok() { + boolean ret = bindings.CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(this.ptr); + return ret; + } + +} diff --git a/ts/structs/Result_NoneMonitorUpdateErrorZ.ts b/ts/structs/Result_NoneMonitorUpdateErrorZ.ts deleted file mode 100644 index 78ebc67b..00000000 --- a/ts/structs/Result_NoneMonitorUpdateErrorZ.ts +++ /dev/null @@ -1,63 +0,0 @@ - -import CommonBase from './CommonBase'; -import * as bindings from '../bindings' // TODO: figure out location - -public class Result_NoneMonitorUpdateErrorZ extends CommonBase { - private Result_NoneMonitorUpdateErrorZ(Object _dummy, long ptr) { super(ptr); } - protected void finalize() throws Throwable { - if (ptr != 0) { bindings.CResult_NoneMonitorUpdateErrorZ_free(ptr); } super.finalize(); - } - - static Result_NoneMonitorUpdateErrorZ constr_from_ptr(long ptr) { - if (bindings.CResult_NoneMonitorUpdateErrorZ_is_ok(ptr)) { - return new Result_NoneMonitorUpdateErrorZ_OK(null, ptr); - } else { - return new Result_NoneMonitorUpdateErrorZ_Err(null, ptr); - } - } - public static final class Result_NoneMonitorUpdateErrorZ_OK extends Result_NoneMonitorUpdateErrorZ { - private Result_NoneMonitorUpdateErrorZ_OK(Object _dummy, long ptr) { - super(_dummy, ptr); - } - } - - public static final class Result_NoneMonitorUpdateErrorZ_Err extends Result_NoneMonitorUpdateErrorZ { - public final MonitorUpdateError err; - private Result_NoneMonitorUpdateErrorZ_Err(Object _dummy, long ptr) { - super(_dummy, ptr); - number err = bindings.LDKCResult_NoneMonitorUpdateErrorZ_get_err(ptr); - const err_hu_conv: MonitorUpdateError = new MonitorUpdateError(null, err); - err_hu_conv.ptrs_to.add(this); - this.err = err_hu_conv; - } - } - - public static Result_NoneMonitorUpdateErrorZ constructor_ok() { - number ret = bindings.CResult_NoneMonitorUpdateErrorZ_ok(); - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - public static Result_NoneMonitorUpdateErrorZ constructor_err(MonitorUpdateError e) { - number ret = bindings.CResult_NoneMonitorUpdateErrorZ_err(e == null ? 0 : e.ptr & ~1); - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - - public boolean is_ok() { - boolean ret = bindings.CResult_NoneMonitorUpdateErrorZ_is_ok(this.ptr); - return ret; - } - - public number clone_ptr() { - number ret = bindings.CResult_NoneMonitorUpdateErrorZ_clone_ptr(this.ptr); - return ret; - } - - public Result_NoneMonitorUpdateErrorZ clone() { - number ret = bindings.CResult_NoneMonitorUpdateErrorZ_clone(this.ptr); - Result_NoneMonitorUpdateErrorZ ret_hu_conv = Result_NoneMonitorUpdateErrorZ.constr_from_ptr(ret); - return ret_hu_conv; - } - -} diff --git a/ts/structs/Result_PaymentPreimageAPIErrorZ.ts b/ts/structs/Result_PaymentPreimageAPIErrorZ.ts new file mode 100644 index 00000000..88f80e1e --- /dev/null +++ b/ts/structs/Result_PaymentPreimageAPIErrorZ.ts @@ -0,0 +1,65 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_PaymentPreimageAPIErrorZ extends CommonBase { + private Result_PaymentPreimageAPIErrorZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentPreimageAPIErrorZ_free(ptr); } super.finalize(); + } + + static Result_PaymentPreimageAPIErrorZ constr_from_ptr(long ptr) { + if (bindings.CResult_PaymentPreimageAPIErrorZ_is_ok(ptr)) { + return new Result_PaymentPreimageAPIErrorZ_OK(null, ptr); + } else { + return new Result_PaymentPreimageAPIErrorZ_Err(null, ptr); + } + } + public static final class Result_PaymentPreimageAPIErrorZ_OK extends Result_PaymentPreimageAPIErrorZ { + public final Uint8Array res; + private Result_PaymentPreimageAPIErrorZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_PaymentPreimageAPIErrorZ_get_ok(ptr); + } + } + + public static final class Result_PaymentPreimageAPIErrorZ_Err extends Result_PaymentPreimageAPIErrorZ { + public final APIError err; + private Result_PaymentPreimageAPIErrorZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + number err = bindings.LDKCResult_PaymentPreimageAPIErrorZ_get_err(ptr); + APIError err_hu_conv = APIError.constr_from_ptr(err); + err_hu_conv.ptrs_to.add(this); + this.err = err_hu_conv; + } + } + + public static Result_PaymentPreimageAPIErrorZ constructor_ok(Uint8Array o) { + number ret = bindings.CResult_PaymentPreimageAPIErrorZ_ok(InternalUtils.check_arr_len(o, 32)); + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_PaymentPreimageAPIErrorZ constructor_err(APIError e) { + number ret = bindings.CResult_PaymentPreimageAPIErrorZ_err(e.ptr); + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public boolean is_ok() { + boolean ret = bindings.CResult_PaymentPreimageAPIErrorZ_is_ok(this.ptr); + return ret; + } + + public number clone_ptr() { + number ret = bindings.CResult_PaymentPreimageAPIErrorZ_clone_ptr(this.ptr); + return ret; + } + + public Result_PaymentPreimageAPIErrorZ clone() { + number ret = bindings.CResult_PaymentPreimageAPIErrorZ_clone(this.ptr); + Result_PaymentPreimageAPIErrorZ ret_hu_conv = Result_PaymentPreimageAPIErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_PaymentSecretNoneZ.ts b/ts/structs/Result_PaymentSecretNoneZ.ts new file mode 100644 index 00000000..6178ba63 --- /dev/null +++ b/ts/structs/Result_PaymentSecretNoneZ.ts @@ -0,0 +1,60 @@ + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + +public class Result_PaymentSecretNoneZ extends CommonBase { + private Result_PaymentSecretNoneZ(Object _dummy, long ptr) { super(ptr); } + protected void finalize() throws Throwable { + if (ptr != 0) { bindings.CResult_PaymentSecretNoneZ_free(ptr); } super.finalize(); + } + + static Result_PaymentSecretNoneZ constr_from_ptr(long ptr) { + if (bindings.CResult_PaymentSecretNoneZ_is_ok(ptr)) { + return new Result_PaymentSecretNoneZ_OK(null, ptr); + } else { + return new Result_PaymentSecretNoneZ_Err(null, ptr); + } + } + public static final class Result_PaymentSecretNoneZ_OK extends Result_PaymentSecretNoneZ { + public final Uint8Array res; + private Result_PaymentSecretNoneZ_OK(Object _dummy, long ptr) { + super(_dummy, ptr); + this.res = bindings.LDKCResult_PaymentSecretNoneZ_get_ok(ptr); + } + } + + public static final class Result_PaymentSecretNoneZ_Err extends Result_PaymentSecretNoneZ { + private Result_PaymentSecretNoneZ_Err(Object _dummy, long ptr) { + super(_dummy, ptr); + } + } + + public static Result_PaymentSecretNoneZ constructor_ok(Uint8Array o) { + number ret = bindings.CResult_PaymentSecretNoneZ_ok(InternalUtils.check_arr_len(o, 32)); + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public static Result_PaymentSecretNoneZ constructor_err() { + number ret = bindings.CResult_PaymentSecretNoneZ_err(); + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public boolean is_ok() { + boolean ret = bindings.CResult_PaymentSecretNoneZ_is_ok(this.ptr); + return ret; + } + + public number clone_ptr() { + number ret = bindings.CResult_PaymentSecretNoneZ_clone_ptr(this.ptr); + return ret; + } + + public Result_PaymentSecretNoneZ clone() { + number ret = bindings.CResult_PaymentSecretNoneZ_clone(this.ptr); + Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret); + return ret_hu_conv; + } + +} diff --git a/ts/structs/Result_ScoringParametersDecodeErrorZ.ts b/ts/structs/Result_ScoringParametersDecodeErrorZ.ts index 742ed89d..ba11e644 100644 --- a/ts/structs/Result_ScoringParametersDecodeErrorZ.ts +++ b/ts/structs/Result_ScoringParametersDecodeErrorZ.ts @@ -37,8 +37,8 @@ public class Result_ScoringParametersDecodeErrorZ extends CommonBase { } } - public static Result_ScoringParametersDecodeErrorZ constructor_ok(number o_base_penalty_msat_arg, number o_failure_penalty_msat_arg, number o_failure_penalty_half_life_arg) { - number ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(bindings.ScoringParameters_new(o_base_penalty_msat_arg, o_failure_penalty_msat_arg, o_failure_penalty_half_life_arg)); + public static Result_ScoringParametersDecodeErrorZ constructor_ok(number o_base_penalty_msat_arg, number o_failure_penalty_msat_arg, number o_overuse_penalty_start_1024th_arg, number o_overuse_penalty_msat_per_1024th_arg, number o_failure_penalty_half_life_arg) { + number ret = bindings.CResult_ScoringParametersDecodeErrorZ_ok(bindings.ScoringParameters_new(o_base_penalty_msat_arg, o_failure_penalty_msat_arg, o_overuse_penalty_start_1024th_arg, o_overuse_penalty_msat_per_1024th_arg, o_failure_penalty_half_life_arg)); Result_ScoringParametersDecodeErrorZ ret_hu_conv = Result_ScoringParametersDecodeErrorZ.constr_from_ptr(ret); return ret_hu_conv; } diff --git a/ts/structs/Router.ts b/ts/structs/Router.ts index 98467779..b6b848ee 100644 --- a/ts/structs/Router.ts +++ b/ts/structs/Router.ts @@ -32,7 +32,7 @@ import * as bindings from '../bindings' // TODO: figure out location const impl_holder: LDKRouterHolder = new LDKRouterHolder(); let structImplementation = { // todo: in-line interface filling - find_route (payer: Uint8Array, params: number, first_hops: number[], scorer: number): number { + find_route (payer: Uint8Array, params: number, payment_hash: Uint8Array, first_hops: number[], scorer: number): number { const params_hu_conv: RouteParameters = new RouteParameters(null, params); ChannelDetails[] first_hops_conv_16_arr = new ChannelDetails[first_hops.length]; for (int q = 0; q < first_hops.length; q++) { @@ -43,7 +43,7 @@ import * as bindings from '../bindings' // TODO: figure out location } Score ret_hu_conv = new Score(null, scorer); ret_hu_conv.ptrs_to.add(this); - Result_RouteLightningErrorZ ret = arg.find_route(payer, params_hu_conv, first_hops_conv_16_arr, ret_hu_conv); + Result_RouteLightningErrorZ ret = arg.find_route(payer, params_hu_conv, payment_hash, first_hops_conv_16_arr, ret_hu_conv); result: number = ret == null ? 0 : ret.clone_ptr(); return result; }, @@ -55,15 +55,15 @@ import * as bindings from '../bindings' // TODO: figure out location } export interface RouterInterface { - find_route(payer: Uint8Array, params: RouteParameters, first_hops: ChannelDetails[], scorer: Score): Result_RouteLightningErrorZ; + find_route(payer: Uint8Array, params: RouteParameters, payment_hash: Uint8Array, first_hops: ChannelDetails[], scorer: Score): Result_RouteLightningErrorZ; } class LDKRouterHolder { held: Router; } - public Result_RouteLightningErrorZ find_route(Uint8Array payer, RouteParameters params, ChannelDetails[] first_hops, Score scorer) { - number ret = bindings.Router_find_route(this.ptr, InternalUtils.check_arr_len(payer, 33), params == null ? 0 : params.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, scorer == null ? 0 : scorer.ptr); + public Result_RouteLightningErrorZ find_route(Uint8Array payer, RouteParameters params, Uint8Array payment_hash, ChannelDetails[] first_hops, Score scorer) { + number ret = bindings.Router_find_route(this.ptr, InternalUtils.check_arr_len(payer, 33), params == null ? 0 : params.ptr & ~1, InternalUtils.check_arr_len(payment_hash, 32), first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, scorer == null ? 0 : scorer.ptr); Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(params); for (ChannelDetails first_hops_conv_16: first_hops) { this.ptrs_to.add(first_hops_conv_16); }; diff --git a/ts/structs/Score.ts b/ts/structs/Score.ts index 9a86ae0e..6c73fe5c 100644 --- a/ts/structs/Score.ts +++ b/ts/structs/Score.ts @@ -32,10 +32,12 @@ import * as bindings from '../bindings' // TODO: figure out location const impl_holder: LDKScoreHolder = new LDKScoreHolder(); let structImplementation = { // todo: in-line interface filling - channel_penalty_msat (short_channel_id: number, source: number, target: number): number { + channel_penalty_msat (short_channel_id: number, send_amt_msat: number, channel_capacity_msat: number, source: number, target: number): number { + Option_u64Z channel_capacity_msat_hu_conv = Option_u64Z.constr_from_ptr(channel_capacity_msat); + channel_capacity_msat_hu_conv.ptrs_to.add(this); const source_hu_conv: NodeId = new NodeId(null, source); const target_hu_conv: NodeId = new NodeId(null, target); - number ret = arg.channel_penalty_msat(short_channel_id, source_hu_conv, target_hu_conv); + number ret = arg.channel_penalty_msat(short_channel_id, send_amt_msat, channel_capacity_msat_hu_conv, source_hu_conv, target_hu_conv); return ret; }, @@ -50,6 +52,17 @@ import * as bindings from '../bindings' // TODO: figure out location arg.payment_path_failed(path_conv_10_arr, short_channel_id); }, + payment_path_successful (path: number[]): void { + RouteHop[] path_conv_10_arr = new RouteHop[path.length]; + for (int k = 0; k < path.length; k++) { + number path_conv_10 = path[k]; + const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10); + path_conv_10_hu_conv.ptrs_to.add(this); + path_conv_10_arr[k] = path_conv_10_hu_conv; + } + arg.payment_path_successful(path_conv_10_arr); + }, + write (): Uint8Array { Uint8Array ret = arg.write(); return ret; @@ -62,8 +75,9 @@ import * as bindings from '../bindings' // TODO: figure out location } export interface ScoreInterface { - channel_penalty_msat(short_channel_id: number, source: NodeId, target: NodeId): number; + channel_penalty_msat(short_channel_id: number, send_amt_msat: number, channel_capacity_msat: Option_u64Z, source: NodeId, target: NodeId): number; payment_path_failed(path: RouteHop[], short_channel_id: number): void; + payment_path_successful(path: RouteHop[]): void; write(): Uint8Array; } @@ -71,8 +85,8 @@ import * as bindings from '../bindings' // TODO: figure out location class LDKScoreHolder { held: Score; } - public number channel_penalty_msat(number short_channel_id, NodeId source, NodeId target) { - number ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1); + public number channel_penalty_msat(number short_channel_id, number send_amt_msat, Option_u64Z channel_capacity_msat, NodeId source, NodeId target) { + number ret = bindings.Score_channel_penalty_msat(this.ptr, short_channel_id, send_amt_msat, channel_capacity_msat.ptr, source == null ? 0 : source.ptr & ~1, target == null ? 0 : target.ptr & ~1); this.ptrs_to.add(source); this.ptrs_to.add(target); return ret; @@ -82,6 +96,10 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.Score_payment_path_failed(this.ptr, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null, short_channel_id); } + public void payment_path_successful(RouteHop[] path) { + bindings.Score_payment_path_successful(this.ptr, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null); + } + public Uint8Array write() { Uint8Array ret = bindings.Score_write(this.ptr); return ret; diff --git a/ts/structs/Scorer.ts b/ts/structs/Scorer.ts index 4c63fa03..ac26dd3f 100644 --- a/ts/structs/Scorer.ts +++ b/ts/structs/Scorer.ts @@ -18,8 +18,8 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.Scorer_free(this.ptr); } } - public static Scorer constructor_new(number params_base_penalty_msat_arg, number params_failure_penalty_msat_arg, number params_failure_penalty_half_life_arg) { - number ret = bindings.Scorer_new(bindings.ScoringParameters_new(params_base_penalty_msat_arg, params_failure_penalty_msat_arg, params_failure_penalty_half_life_arg)); + public static Scorer constructor_new(number params_base_penalty_msat_arg, number params_failure_penalty_msat_arg, number params_overuse_penalty_start_1024th_arg, number params_overuse_penalty_msat_per_1024th_arg, number params_failure_penalty_half_life_arg) { + number ret = bindings.Scorer_new(bindings.ScoringParameters_new(params_base_penalty_msat_arg, params_failure_penalty_msat_arg, params_overuse_penalty_start_1024th_arg, params_overuse_penalty_msat_per_1024th_arg, params_failure_penalty_half_life_arg)); const ret_hu_conv: Scorer = new Scorer(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/ScoringParameters.ts b/ts/structs/ScoringParameters.ts index edbe4bcc..18e17f3c 100644 --- a/ts/structs/ScoringParameters.ts +++ b/ts/structs/ScoringParameters.ts @@ -36,6 +36,24 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ScoringParameters_set_failure_penalty_msat(this.ptr, val); } + public number get_overuse_penalty_start_1024th() { + number ret = bindings.ScoringParameters_get_overuse_penalty_start_1024th(this.ptr); + return ret; + } + + public void set_overuse_penalty_start_1024th(number val) { + bindings.ScoringParameters_set_overuse_penalty_start_1024th(this.ptr, val); + } + + public number get_overuse_penalty_msat_per_1024th() { + number ret = bindings.ScoringParameters_get_overuse_penalty_msat_per_1024th(this.ptr); + return ret; + } + + public void set_overuse_penalty_msat_per_1024th(number val) { + bindings.ScoringParameters_set_overuse_penalty_msat_per_1024th(this.ptr, val); + } + public number get_failure_penalty_half_life() { number ret = bindings.ScoringParameters_get_failure_penalty_half_life(this.ptr); return ret; @@ -45,8 +63,8 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.ScoringParameters_set_failure_penalty_half_life(this.ptr, val); } - public static ScoringParameters constructor_new(number base_penalty_msat_arg, number failure_penalty_msat_arg, number failure_penalty_half_life_arg) { - number ret = bindings.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, failure_penalty_half_life_arg); + public static ScoringParameters constructor_new(number base_penalty_msat_arg, number failure_penalty_msat_arg, number overuse_penalty_start_1024th_arg, number overuse_penalty_msat_per_1024th_arg, number failure_penalty_half_life_arg) { + number ret = bindings.ScoringParameters_new(base_penalty_msat_arg, failure_penalty_msat_arg, overuse_penalty_start_1024th_arg, overuse_penalty_msat_per_1024th_arg, failure_penalty_half_life_arg); const ret_hu_conv: ScoringParameters = new ScoringParameters(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/TrustedCommitmentTransaction.ts b/ts/structs/TrustedCommitmentTransaction.ts index 09248f42..cb0c2bfc 100644 --- a/ts/structs/TrustedCommitmentTransaction.ts +++ b/ts/structs/TrustedCommitmentTransaction.ts @@ -37,6 +37,11 @@ import * as bindings from '../bindings' // TODO: figure out location return ret_hu_conv; } + public boolean opt_anchors() { + boolean ret = bindings.TrustedCommitmentTransaction_opt_anchors(this.ptr); + return ret; + } + public Result_CVec_SignatureZNoneZ get_htlc_sigs(Uint8Array htlc_base_key, DirectedChannelTransactionParameters channel_parameters) { number ret = bindings.TrustedCommitmentTransaction_get_htlc_sigs(this.ptr, InternalUtils.check_arr_len(htlc_base_key, 32), channel_parameters == null ? 0 : channel_parameters.ptr & ~1); Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret); diff --git a/ts/structs/UserConfig.ts b/ts/structs/UserConfig.ts index 0cc921e6..06742340 100644 --- a/ts/structs/UserConfig.ts +++ b/ts/structs/UserConfig.ts @@ -60,8 +60,17 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.UserConfig_set_accept_forwards_to_priv_channels(this.ptr, val); } - public static UserConfig constructor_new(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg, boolean accept_forwards_to_priv_channels_arg) { - number ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1, accept_forwards_to_priv_channels_arg); + public boolean get_accept_inbound_channels() { + boolean ret = bindings.UserConfig_get_accept_inbound_channels(this.ptr); + return ret; + } + + public void set_accept_inbound_channels(boolean val) { + bindings.UserConfig_set_accept_inbound_channels(this.ptr, val); + } + + public static UserConfig constructor_new(ChannelHandshakeConfig own_channel_config_arg, ChannelHandshakeLimits peer_channel_config_limits_arg, ChannelConfig channel_options_arg, boolean accept_forwards_to_priv_channels_arg, boolean accept_inbound_channels_arg) { + number ret = bindings.UserConfig_new(own_channel_config_arg == null ? 0 : own_channel_config_arg.ptr & ~1, peer_channel_config_limits_arg == null ? 0 : peer_channel_config_limits_arg.ptr & ~1, channel_options_arg == null ? 0 : channel_options_arg.ptr & ~1, accept_forwards_to_priv_channels_arg, accept_inbound_channels_arg); const ret_hu_conv: UserConfig = new UserConfig(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; diff --git a/ts/structs/UtilMethods.ts b/ts/structs/UtilMethods.ts index 17fcb276..5dced389 100644 --- a/ts/structs/UtilMethods.ts +++ b/ts/structs/UtilMethods.ts @@ -1,3 +1,13 @@ + public static COption_NoneZ constructor_COption_NoneZ_some() { + COption_NoneZ ret = bindings.COption_NoneZ_some(); + return ret; + } + + public static COption_NoneZ constructor_COption_NoneZ_none() { + COption_NoneZ ret = bindings.COption_NoneZ_none(); + return ret; + } + public static Result_COption_ClosureReasonZDecodeErrorZ constructor_ClosureReason_read(Uint8Array ser) { number ret = bindings.ClosureReason_read(ser); Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret); @@ -53,6 +63,16 @@ return ret_hu_conv; } + public static number constructor_htlc_success_tx_weight(boolean opt_anchors) { + number ret = bindings.htlc_success_tx_weight(opt_anchors); + return ret; + } + + public static number constructor_htlc_timeout_tx_weight(boolean opt_anchors) { + number ret = bindings.htlc_timeout_tx_weight(opt_anchors); + return ret; + } + public static Uint8Array constructor_build_commitment_secret(Uint8Array commitment_seed, number idx) { Uint8Array ret = bindings.build_commitment_secret(InternalUtils.check_arr_len(commitment_seed, 32), idx); return ret; @@ -92,8 +112,8 @@ return ret; } - public static Uint8Array constructor_get_htlc_redeemscript(HTLCOutputInCommitment htlc, TxCreationKeys keys) { - Uint8Array ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr & ~1, keys == null ? 0 : keys.ptr & ~1); + public static Uint8Array constructor_get_htlc_redeemscript(HTLCOutputInCommitment htlc, boolean opt_anchors, TxCreationKeys keys) { + Uint8Array ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr & ~1, opt_anchors, keys == null ? 0 : keys.ptr & ~1); // this.ptrs_to.add(htlc); // this.ptrs_to.add(keys); return ret; @@ -104,12 +124,17 @@ return ret; } - public static Uint8Array constructor_build_htlc_transaction(Uint8Array commitment_txid, number feerate_per_kw, number contest_delay, HTLCOutputInCommitment htlc, Uint8Array broadcaster_delayed_payment_key, Uint8Array revocation_key) { - Uint8Array ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr & ~1, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33)); + public static Uint8Array constructor_build_htlc_transaction(Uint8Array commitment_txid, number feerate_per_kw, number contest_delay, HTLCOutputInCommitment htlc, boolean opt_anchors, Uint8Array broadcaster_delayed_payment_key, Uint8Array revocation_key) { + Uint8Array ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr & ~1, opt_anchors, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33)); // this.ptrs_to.add(htlc); return ret; } + public static Uint8Array constructor_get_anchor_redeemscript(Uint8Array funding_pubkey) { + Uint8Array ret = bindings.get_anchor_redeemscript(InternalUtils.check_arr_len(funding_pubkey, 33)); + return ret; + } + public static number constructor_get_commitment_transaction_number_obscure_factor(Uint8Array broadcaster_payment_basepoint, Uint8Array countersignatory_payment_basepoint, boolean outbound_from_broadcaster) { number ret = bindings.get_commitment_transaction_number_obscure_factor(InternalUtils.check_arr_len(broadcaster_payment_basepoint, 33), InternalUtils.check_arr_len(countersignatory_payment_basepoint, 33), outbound_from_broadcaster); return ret; -- 2.30.2