}
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], 1);
+ 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.node_id = chan_manager.get_our_node_id();
this.chan_manager_events = chan_manager.as_EventsProvider();
txn = new TwoTuple[]{txp};
} else
txn = new TwoTuple[0];
- chan_manager.block_connected(header, txn, height);
+ chan_manager.as_Listen().block_connected(b.bitcoinSerialize(), height);
if (chain_monitor != null) {
chain_monitor.block_connected(header, txn, height);
} else {
Transaction tx = new Transaction(bitcoinj_net, state.peer1.broadcast_set.getFirst());
Block b = new Block(bitcoinj_net, 2, state.best_blockhash, Sha256Hash.ZERO_HASH, 42, 0, 0,
Arrays.asList(new Transaction[]{tx}));
- TwoTuple<byte[], TwoTuple<Integer, TxOut>[]>[] watch_outputs = state.peer2.connect_block(b, 1, 1);
+ TwoTuple<byte[], TwoTuple<Integer, TxOut>[]>[] watch_outputs = state.peer2.connect_block(b, 10, 1);
if (watch_outputs != null) { // We only process watch_outputs manually when we use a manually-build Watch impl
assert watch_outputs.length == 1;
assert Arrays.equals(watch_outputs[0].a, tx.getTxId().getReversedBytes());
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], 1);
+ long params = bindings.ChainParameters_new(LDKNetwork.LDKNetwork_Bitcoin, 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);
}
void connect_block(Block b, Transaction t, int height) {
- byte[] header = Arrays.copyOfRange(b.bitcoinSerialize(), 0, 80);
- long[] txn;
- if (t != null)
- txn = new long[]{bindings.C2Tuple_usizeTransactionZ_new(1, t.bitcoinSerialize())};
- else
- txn = new long[0];
- bindings.ChannelManager_block_connected(chan_manager, header, txn, height);
+ long listen = bindings.ChannelManager_as_Listen(chan_manager);
+ bindings.Listen_block_connected(listen, b.bitcoinSerialize(), height);
+ bindings.Listen_free(listen);
synchronized (monitors) {
for (Long mon : monitors.values()) {
+ long[] txn;
if (t != null)
txn = new long[]{bindings.C2Tuple_usizeTransactionZ_new(1, t.bitcoinSerialize())};
else
txn = new long[0];
+ byte[] header = Arrays.copyOfRange(b.bitcoinSerialize(), 0, 80);
long[] ret = bindings.ChannelMonitor_block_connected(mon, header, txn, height, tx_broadcaster, fee_estimator, logger);
for (long r : ret) {
bindings.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(r);
peer2.connect_block(b, funding, 1);
for (int height = 2; height < 10; height++) {
- b = new Block(NetworkParameters.fromID(NetworkParameters.ID_MAINNET), 2, b.getHash(), Sha256Hash.ZERO_HASH, 42, 0, 0, Arrays.asList(new Transaction[]{funding}));
+ b = new Block(NetworkParameters.fromID(NetworkParameters.ID_MAINNET), 2, b.getHash(), Sha256Hash.ZERO_HASH, 42, 0, 0, Arrays.asList(new Transaction[0]));
peer1.connect_block(b, null, height);
peer2.connect_block(b, null, height);
}