channel_monitors = new TwoTuple[0];
channel_manager_latest_block_hash = null;
this.chain_monitor = chain_monitor;
- channel_manager = ChannelManager.constructor_new(fee_estimator, chain_monitor.as_Watch(), tx_broadcaster, logger, keys_interface, config, network, current_blockchain_tip_hash, current_blockchain_tip_height);
+ BestBlock block = BestBlock.constructor_new(current_blockchain_tip_hash, current_blockchain_tip_height);
+ channel_manager = ChannelManager.constructor_new(fee_estimator, chain_monitor.as_Watch(), tx_broadcaster, logger, keys_interface, config, network, block);
}
/**
need_persist = true;
}
events = this.chain_monitor.as_EventsProvider().get_and_clear_pending_events();
+
if (events.length != 0) {
persister.handle_events(events);
need_persist = true;
return;
}
if (lastTimerTick < System.currentTimeMillis() - 60 * 1000) {
- this.channel_manager.timer_chan_freshness_every_min();
+ this.channel_manager.timer_tick_occurred();
lastTimerTick = System.currentTimeMillis();
}
}
@Override
public Sign get_channel_signer(boolean inbound, long channel_value_satoshis) {
Sign underlying_ck = underlying_if.get_channel_signer(inbound, channel_value_satoshis);
- Sign.SignInterface si = new Sign.SignInterface() {
+ // TODO: Expose the underlying signer from a Sign
+ /*BaseSign.BaseSignInterface si = new BaseSign.BaseSignInterface() {
@Override
public byte[] get_per_commitment_point(long idx) {
return underlying_ck.get_per_commitment_point(idx);
public byte[] write() {
return underlying_ck.write();
}
- };
- Sign resp = Sign.new_impl(si, underlying_ck.get_pubkeys());
- must_free_objs.add(new WeakReference<>(si));
- must_free_objs.add(new WeakReference<>(resp));
+ };*/
+ //Sign resp = Sign.new_impl(si, underlying_ck.get_pubkeys());
+ //must_free_objs.add(new WeakReference<>(si));
+ //must_free_objs.add(new WeakReference<>(resp));
must_free_objs.add(new WeakReference<>(underlying_ck));
- return resp;
+ //return resp;
+ return underlying_ck;
}
@Override
}
Peer(byte seed) {
this(null, seed);
- this.chan_manager = ChannelManager.constructor_new(FeeEstimator.new_impl(confirmation_target -> 0), chain_watch, tx_broadcaster, logger, this.keys_interface, UserConfig.constructor_default(), LDKNetwork.LDKNetwork_Bitcoin, new byte[32], 0);
+ this.chan_manager = ChannelManager.constructor_new(FeeEstimator.new_impl(confirmation_target -> 0), chain_watch, tx_broadcaster, logger, this.keys_interface, UserConfig.constructor_default(), LDKNetwork.LDKNetwork_Bitcoin, BestBlock.constructor_new(new byte[32], 0));
this.node_id = chan_manager.get_our_node_id();
this.chan_manager_events = chan_manager.as_EventsProvider();
funding.getInputs().get(0).setWitness(new TransactionWitness(2)); // Make sure we don't complain about lack of witness
funding.getInput(0).getWitness().setPush(0, new byte[]{0x1});
funding.addOutput(Coin.SATOSHI.multiply(10000), new Script(funding_spk));
- Result_NoneAPIErrorZ funding_res = peer1.chan_manager.funding_transaction_generated(chan_id, funding.bitcoinSerialize(), (short) 0);
+ Result_NoneAPIErrorZ funding_res = peer1.chan_manager.funding_transaction_generated(chan_id, funding.bitcoinSerialize());
assert funding_res instanceof Result_NoneAPIErrorZ.Result_NoneAPIErrorZ_OK;
wait_events_processed(peer1, peer2);
import org.bitcoinj.core.*;
import org.bitcoinj.script.Script;
import org.junit.jupiter.api.Test;
+import org.ldk.enums.LDKNetwork;
import org.ldk.impl.bindings;
-import org.ldk.enums.*;
-import org.ldk.structs.Result_NoneChannelMonitorUpdateErrZ;
import java.util.ArrayList;
import java.util.Arrays;
this.keys = bindings.KeysManager_new(key_seed, System.currentTimeMillis() / 1000, (int)(System.currentTimeMillis() * 1000) & 0xffffffff);
this.keys_interface = bindings.KeysManager_as_KeysInterface(keys);
this.config = bindings.UserConfig_default();
- long params = bindings.ChainParameters_new(LDKNetwork.LDKNetwork_Bitcoin, new byte[32], 0);
+ long params = bindings.ChainParameters_new(LDKNetwork.LDKNetwork_Bitcoin, bindings.BestBlock_new(new byte[32], 0));
this.chan_manager = bindings.ChannelManager_new(fee_estimator, chain_monitor, tx_broadcaster, logger, keys_interface, config, params);
this.node_id = bindings.ChannelManager_get_our_node_id(chan_manager);
this.chan_manager_events = bindings.ChannelManager_as_EventsProvider(chan_manager);
funding.getInputs().get(0).setWitness(new TransactionWitness(2)); // Make sure we don't complain about lack of witness
funding.getInput(0).getWitness().setPush(0, new byte[] {0x1});
funding.addOutput(Coin.SATOSHI.multiply(10000), new Script(funding_spk));
- bindings.ChannelManager_funding_transaction_generated(peer1.chan_manager, chan_id, funding.bitcoinSerialize(), (short)0);
+ bindings.ChannelManager_funding_transaction_generated(peer1.chan_manager, chan_id, funding.bitcoinSerialize());
bindings.PeerManager_process_events(peer1.peer_manager);
while (!list.isEmpty()) { list.poll().join(); }