X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fldk%2FHumanObjectPeerTest.java;h=80c7cf61e1e5dd8bc6c986bdb8432fdbc8e40745;hb=e30b350e325e7d517ea744578876d473839ad495;hp=a123b6e31b270cfcb1820b8adb62425ecf34e5bf;hpb=99d1a3bd6dc5c7ed1499b30bfc2b4c66ffaf858a;p=ldk-java diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index a123b6e3..80c7cf61 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -7,6 +7,7 @@ import org.ldk.batteries.ChannelManagerConstructor; import org.ldk.batteries.NioPeerHandler; import org.ldk.enums.AccessError; import org.ldk.enums.Currency; +import org.ldk.enums.Level; import org.ldk.enums.Network; import org.ldk.structs.*; import org.ldk.util.TwoTuple; @@ -174,7 +175,7 @@ class HumanObjectPeerTestInstance { NetGraphMsgHandler route_handler; final Watch chain_watch; final HashSet filter_additions; - final Option_FilterZ filter; + Option_FilterZ filter; ChannelManager chan_manager; PeerManager peer_manager; final HashMap monitors; // Wow I forgot just how terrible Java is - we can't put a byte array here. @@ -201,7 +202,12 @@ class HumanObjectPeerTestInstance { } private Peer(Object _dummy, byte seed) { - logger = Logger.new_impl((String arg) -> System.out.println(seed + ": " + arg)); + logger = Logger.new_impl((Record arg)->{ + if (arg.get_level() == Level.LDKLevel_Error) + System.err.println(seed + ": " + arg.get_module_path() + " - " + arg.get_args()); + else + System.out.println(seed + ": " + arg.get_module_path() + " - " + arg.get_args()); + }); fee_estimator = FeeEstimator.new_impl((confirmation_target -> 253)); tx_broadcaster = BroadcasterInterface.new_impl(tx -> { synchronized (broadcast_set) { @@ -387,6 +393,7 @@ class HumanObjectPeerTestInstance { } this.node_id = chan_manager.get_our_node_id(); + this.filter = null; bind_nio(); System.gc(); } @@ -403,11 +410,13 @@ class HumanObjectPeerTestInstance { filter_nullable = ((Option_FilterZ.Some) this.filter).some; } if (use_ignore_handler) { - this.constructor = new ChannelManagerConstructor(serialized, monitors, this.keys_interface, - this.fee_estimator, this.chain_monitor, filter_nullable, null, this.tx_broadcaster, this.logger); + this.constructor = new ChannelManagerConstructor(serialized, monitors, UserConfig.with_default(), + this.keys_interface, this.fee_estimator, this.chain_monitor, filter_nullable, + null, this.tx_broadcaster, this.logger); } else { - this.constructor = new ChannelManagerConstructor(serialized, monitors, this.keys_interface, - this.fee_estimator, this.chain_monitor, filter_nullable, this.router, this.tx_broadcaster, this.logger); + this.constructor = new ChannelManagerConstructor(serialized, monitors, UserConfig.with_default(), + this.keys_interface, this.fee_estimator, this.chain_monitor, filter_nullable, + this.router, this.tx_broadcaster, this.logger); } LockableScore scorer = null; if (use_invoice_payer) { scorer = LockableScore.of(Scorer.with_default().as_Score()); } @@ -493,6 +502,7 @@ class HumanObjectPeerTestInstance { // the ChannelSigner. this.ptr_to = orig.chan_manager; } + this.filter = null; } TwoTuple_TxidCVec_C2Tuple_u32TxOutZZZ[] connect_block(Block b, int height, long expected_monitor_update_len) { @@ -1021,6 +1031,8 @@ class HumanObjectPeerTestInstance { t.interrupt(); + state.peer1.router.write(); + // Construct the only Option_Enum::Variant(OpaqueStruct) we have in the codebase as this used to cause double-frees: byte[] serd = new byte[] {(byte)0xd9,(byte)0x77,(byte)0xcb,(byte)0x9b,(byte)0x53,(byte)0xd9,(byte)0x3a,(byte)0x6f,(byte)0xf6,(byte)0x4b,(byte)0xb5,(byte)0xf1,(byte)0xe1,(byte)0x58,(byte)0xb4,(byte)0x09,(byte)0x4b,(byte)0x66,(byte)0xe7,(byte)0x98,(byte)0xfb,(byte)0x12,(byte)0x91,(byte)0x11,(byte)0x68,(byte)0xa3,(byte)0xcc,(byte)0xdf,(byte)0x80,(byte)0xa8,(byte)0x30,(byte)0x96,(byte)0x34,(byte)0x0a,(byte)0x6a,(byte)0x95,(byte)0xda,(byte)0x0a,(byte)0xe8,(byte)0xd9,(byte)0xf7,(byte)0x76,(byte)0x52,(byte)0x8e,(byte)0xec,(byte)0xdb,(byte)0xb7,(byte)0x47,(byte)0xeb,(byte)0x6b,(byte)0x54,(byte)0x54,(byte)0x95,(byte)0xa4,(byte)0x31,(byte)0x9e,(byte)0xd5,(byte)0x37,(byte)0x8e,(byte)0x35,(byte)0xb2,(byte)0x1e,(byte)0x07,(byte)0x3a,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x19,(byte)0xd6,(byte)0x68,(byte)0x9c,(byte)0x08,(byte)0x5a,(byte)0xe1,(byte)0x65,(byte)0x83,(byte)0x1e,(byte)0x93,(byte)0x4f,(byte)0xf7,(byte)0x63,(byte)0xae,(byte)0x46,(byte)0xa2,(byte)0xa6,(byte)0xc1,(byte)0x72,(byte)0xb3,(byte)0xf1,(byte)0xb6,(byte)0x0a,(byte)0x8c,(byte)0xe2,(byte)0x6f,(byte)0x00,(byte)0x08,(byte)0x3a,(byte)0x84,(byte)0x00,(byte)0x00,(byte)0x03,(byte)0x4d,(byte)0x01,(byte)0x34,(byte)0x13,(byte)0xa7,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x90,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x0f,(byte)0x42,(byte)0x40,(byte)0x00,(byte)0x00,(byte)0x27,(byte)0x10,(byte)0x00,(byte)0x00,(byte)0x00,(byte)0x14,}; Result_ChannelUpdateDecodeErrorZ upd_msg = ChannelUpdate.read(serd);