txn = new TwoTuple[]{txp};
} else
txn = new TwoTuple[0];
- chan_manager.as_Listen().block_connected(b.bitcoinSerialize(), height);
if (chain_monitor != null) {
+ chan_manager.as_Listen().block_connected(b.bitcoinSerialize(), height);
chain_monitor.block_connected(header, txn, height);
} else {
+ chan_manager.transactions_confirmed(header, height, txn);
+ chan_manager.update_best_block(header, height);
+ // Connect manually if we aren't using a ChainMonitor and are implementing Watch ourselves
synchronized (monitors) {
assert monitors.size() == 1;
for (ChannelMonitor mon : monitors.values()) {
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));
- peer1.chan_manager.funding_transaction_generated(chan_id, OutPoint.constructor_new(funding.getTxId().getReversedBytes(), (short) 0));
+ Result_NoneAPIErrorZ funding_res = peer1.chan_manager.funding_transaction_generated(chan_id, funding.bitcoinSerialize(), (short) 0);
+ assert funding_res instanceof Result_NoneAPIErrorZ.Result_NoneAPIErrorZ_OK;
wait_events_processed(peer1, peer2);
- events = peer1.chan_manager_events.get_and_clear_pending_events();
- assert events.length == 1;
- assert events[0] instanceof Event.FundingBroadcastSafe;
- assert ((Event.FundingBroadcastSafe) events[0]).user_channel_id == 42;
+ assert peer1.broadcast_set.size() == 1;
+ assert Arrays.equals(peer1.broadcast_set.get(0), funding.bitcoinSerialize());
+ peer1.broadcast_set.clear();
Block b = new Block(bitcoinj_net, 2, Sha256Hash.ZERO_HASH, Sha256Hash.ZERO_HASH, 42, 0, 0, Arrays.asList(new Transaction[]{funding}));
peer1.connect_block(b, 1, 0);
wait_events_processed(state.peer1, state.peer2);
assert state.peer1.broadcast_set.size() == 1;
- assert state.peer2.broadcast_set.size() == 0;
+ assert state.peer2.broadcast_set.size() == 1;
NetworkParameters bitcoinj_net = NetworkParameters.fromID(NetworkParameters.ID_MAINNET);
Transaction tx = new Transaction(bitcoinj_net, state.peer1.broadcast_set.getFirst());
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));
- long funding_txo = bindings.OutPoint_new(funding.getTxId().getReversedBytes(), (short) 0);
- bindings.ChannelManager_funding_transaction_generated(peer1.chan_manager, chan_id, funding_txo);
- bindings.OutPoint_free(funding_txo);
+ bindings.ChannelManager_funding_transaction_generated(peer1.chan_manager, chan_id, funding.bitcoinSerialize(), (short)0);
bindings.PeerManager_process_events(peer1.peer_manager);
while (!list.isEmpty()) { list.poll().join(); }
bindings.PeerManager_process_events(peer2.peer_manager);
while (!list.isEmpty()) { list.poll().join(); }
- events = bindings.EventsProvider_get_and_clear_pending_events(peer1.chan_manager_events);
- assert events.length == 1;
- event = bindings.LDKEvent_ref_from_ptr(events[0]);
- assert event instanceof bindings.LDKEvent.FundingBroadcastSafe;
- bindings.CVec_EventZ_free(events);
-
Block b = new Block(NetworkParameters.fromID(NetworkParameters.ID_MAINNET), 2, Sha256Hash.ZERO_HASH, Sha256Hash.ZERO_HASH, 42, 0, 0, Arrays.asList(new Transaction[]{funding}));
peer1.connect_block(b, funding, 1);
peer2.connect_block(b, funding, 1);