KeysInterface manual_keysif(KeysInterface underlying_if) {
return KeysInterface.new_impl(new KeysInterface.KeysInterfaceInterface() {
@Override public Result_SecretKeyNoneZ get_node_secret(Recipient recipient) { return underlying_if.get_node_secret(recipient); }
+ @Override public Result_PublicKeyNoneZ get_node_id(Recipient recipient) { return underlying_if.get_node_id(recipient); }
@Override public Result_SharedSecretNoneZ ecdh(Recipient recipient, byte[] other_key, Option_ScalarZ tweak) { return underlying_if.ecdh(recipient, other_key, tweak); }
@Override public byte[] get_destination_script() { return underlying_if.get_destination_script(); }
@Override public Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx) {
return underlying_base.sign_closing_transaction(closing_tx);
}
+ @Override public Result_SignatureNoneZ sign_holder_anchor_input(byte[] anchor_tx, long input) {
+ return underlying_base.sign_holder_anchor_input(anchor_tx, input);
+ }
@Override public Result_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement(UnsignedChannelAnnouncement msg) {
return underlying_base.sign_channel_announcement(msg);
}
Watch get_manual_watch() {
Watch.WatchInterface watch_impl = new Watch.WatchInterface() {
- public Result_NoneChannelMonitorUpdateErrZ watch_channel(OutPoint funding_txo, ChannelMonitor monitor) {
+ public ChannelMonitorUpdateStatus watch_channel(OutPoint funding_txo, ChannelMonitor monitor) {
synchronized (monitors) {
assert monitors.put(Arrays.toString(funding_txo.get_txid()), monitor) == null;
}
- return Result_NoneChannelMonitorUpdateErrZ.ok();
+ return ChannelMonitorUpdateStatus.LDKChannelMonitorUpdateStatus_Completed;
}
- public Result_NoneChannelMonitorUpdateErrZ update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) {
+ public ChannelMonitorUpdateStatus update_channel(OutPoint funding_txo, ChannelMonitorUpdate update) {
synchronized (monitors) {
String txid = Arrays.toString(funding_txo.get_txid());
assert monitors.containsKey(txid);
Result_NoneNoneZ update_res = monitors.get(txid).update_monitor(update, tx_broadcaster, fee_estimator, logger);
assert update_res instanceof Result_NoneNoneZ.Result_NoneNoneZ_OK;
}
- return Result_NoneChannelMonitorUpdateErrZ.ok();
+ return ChannelMonitorUpdateStatus.LDKChannelMonitorUpdateStatus_Completed;
}
@Override
this.seed = seed;
Persist persister = Persist.new_impl(new Persist.PersistInterface() {
@Override
- public Result_NoneChannelMonitorUpdateErrZ persist_new_channel(OutPoint id, ChannelMonitor data, MonitorUpdateId update_id) {
+ public ChannelMonitorUpdateStatus persist_new_channel(OutPoint id, ChannelMonitor data, MonitorUpdateId update_id) {
synchronized (monitors) {
String key = Arrays.toString(id.to_channel_id());
ChannelMonitor res = test_mon_roundtrip(id, data.write());
assert monitors.put(key, res) == null;
}
- return Result_NoneChannelMonitorUpdateErrZ.ok();
+ return ChannelMonitorUpdateStatus.LDKChannelMonitorUpdateStatus_Completed;
}
@Override
- public Result_NoneChannelMonitorUpdateErrZ update_persisted_channel(OutPoint id, ChannelMonitorUpdate update, ChannelMonitor data, MonitorUpdateId update_id) {
+ public ChannelMonitorUpdateStatus update_persisted_channel(OutPoint id, ChannelMonitorUpdate update, ChannelMonitor data, MonitorUpdateId update_id) {
synchronized (monitors) {
String key = Arrays.toString(id.to_channel_id());
ChannelMonitor res = test_mon_roundtrip(id, data.write());
// expose the JVM JIT bug where it finalize()s things still being called.
assert monitors.put(key, res) != null;
}
- return Result_NoneChannelMonitorUpdateErrZ.ok();
+ return ChannelMonitorUpdateStatus.LDKChannelMonitorUpdateStatus_Completed;
}
});
assert node_secret.is_ok();
this.peer_manager = PeerManager.of(chan_manager.as_ChannelMessageHandler(), route_handler.as_RoutingMessageHandler(),
IgnoringMessageHandler.of().as_OnionMessageHandler(),
- ((Result_SecretKeyNoneZ.Result_SecretKeyNoneZ_OK)node_secret).res, System.currentTimeMillis() / 1000,
+ ((Result_SecretKeyNoneZ.Result_SecretKeyNoneZ_OK)node_secret).res, (int)(System.currentTimeMillis() / 1000),
random_data, logger, this.custom_message_handler);
if (use_invoice_payer) {
this.payer = InvoicePayer.of(this.chan_manager.as_Payer(), Router.new_impl(new Router.RouterInterface() {
assert node_secret.is_ok();
this.peer_manager = PeerManager.of(chan_manager.as_ChannelMessageHandler(), route_handler.as_RoutingMessageHandler(),
IgnoringMessageHandler.of().as_OnionMessageHandler(),
- ((Result_SecretKeyNoneZ.Result_SecretKeyNoneZ_OK)node_secret).res, System.currentTimeMillis() / 1000,
+ ((Result_SecretKeyNoneZ.Result_SecretKeyNoneZ_OK)node_secret).res, (int)(System.currentTimeMillis() / 1000),
random_data, logger, this.custom_message_handler);
if (!break_cross_peer_refs && (use_manual_watch || use_km_wrapper)) {
// When we pass monitors[0] into chain_watch.watch_channel we create a reference from the new Peer to a
assert Arrays.equals(peer1_chans[0].get_channel_id(), funding.getTxId().getReversedBytes());
assert Arrays.equals(peer2_chans[0].get_channel_id(), funding.getTxId().getReversedBytes());
- Result_InvoiceSignOrCreationErrorZ invoice = UtilMethods.create_invoice_from_channelmanager(peer2.chan_manager, peer2.keys_interface, Currency.LDKCurrency_Bitcoin, Option_u64Z.some(10000000), "Invoice Description", 7200);
+ Result_InvoiceSignOrCreationErrorZ invoice = UtilMethods.create_invoice_from_channelmanager(peer2.chan_manager, peer2.keys_interface, peer2.logger, Currency.LDKCurrency_Bitcoin, Option_u64Z.some(10000000), "Invoice Description", 7200);
assert invoice instanceof Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK;
System.out.println("Got invoice: " + ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK) invoice).res.to_str());
byte[] hop_pubkey = new byte[33];
hop_pubkey[0] = 3;
hop_pubkey[1] = 42;
- hops[0][0] = RouteHop.of(hop_pubkey, NodeFeatures.known(), 42, ChannelFeatures.known(), 100, 0);
+ NodeFeatures node_features = NodeFeatures.empty();
+ ChannelFeatures channel_features = ChannelFeatures.empty();
+ hops[0][0] = RouteHop.of(hop_pubkey, node_features, 42, channel_features, 100, 0);
Route r2 = Route.of(hops, payee);
payment_res = peer1.chan_manager.send_payment(r2, payment_hash, payment_secret);
assert payment_res instanceof Result_PaymentIdPaymentSendFailureZ.Result_PaymentIdPaymentSendFailureZ_Err;
import org.bitcoinj.core.*;
import org.bitcoinj.script.Script;
import org.junit.jupiter.api.Test;
+import org.ldk.enums.ChannelMonitorUpdateStatus;
import org.ldk.enums.Network;
import org.ldk.enums.Recipient;
import org.ldk.impl.bindings;
this.monitors = new HashMap<>();
this.watcher = new bindings.LDKWatch() {
@Override
- public long watch_channel(long funding_txo, long monitor) {
+ public ChannelMonitorUpdateStatus watch_channel(long funding_txo, long monitor) {
synchronized (monitors) {
assert monitors.put(Arrays.toString(bindings.OutPoint_get_txid(funding_txo)), monitor) == null;
}
bindings.OutPoint_free(funding_txo);
- return bindings.CResult_NoneChannelMonitorUpdateErrZ_ok();
+ return ChannelMonitorUpdateStatus.LDKChannelMonitorUpdateStatus_Completed;
}
@Override
- public long update_channel(long funding_txo, long update) {
+ public ChannelMonitorUpdateStatus update_channel(long funding_txo, long update) {
synchronized (monitors) {
String txid = Arrays.toString(bindings.OutPoint_get_txid(funding_txo));
assert monitors.containsKey(txid);
}
bindings.OutPoint_free(funding_txo);
bindings.ChannelMonitorUpdate_free(update);
- return bindings.CResult_NoneChannelMonitorUpdateErrZ_ok();
+ return ChannelMonitorUpdateStatus.LDKChannelMonitorUpdateStatus_Completed;
}
@Override
long node_id_result = bindings.KeysInterface_get_node_secret(keys_interface, Recipient.LDKRecipient_Node);
assert bindings.CResult_SecretKeyNoneZ_is_ok(node_id_result);
this.peer_manager = bindings.PeerManager_new(message_handler, bindings.CResult_SecretKeyNoneZ_get_ok(node_id_result),
- System.currentTimeMillis() / 1000, random_data, logger, this.custom_message_handler);
+ (int)(System.currentTimeMillis() / 1000), random_data, logger, this.custom_message_handler);
bindings.CResult_SecretKeyNoneZ_free(node_id_result);
}
long scorer_interface = bindings.ProbabilisticScorer_as_Score(scorer);
long no_u64 = bindings.COption_u64Z_none();
- long invoice_features = bindings.InvoiceFeatures_known();
+ long invoice_features = bindings.InvoiceFeatures_empty();
+ bindings.InvoiceFeatures_set_payment_secret_required(invoice_features);
+ bindings.InvoiceFeatures_set_variable_length_onion_required(invoice_features);
long payee = bindings.PaymentParameters_new(peer2.node_id, invoice_features, new long[0], no_u64, 6*24*14, (byte)1, (byte)1, new long[0]);
bindings.InvoiceFeatures_free(invoice_features);
bindings.COption_u64Z_free(no_u64);