From: Matt Corallo Date: Thu, 3 Mar 2022 04:06:25 +0000 (+0000) Subject: [Java] Update HumanObjectPeerTest to test Scorer serialization X-Git-Tag: v0.0.105.0~1^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=9d5987cf398f8f012f034a5a069f3928286b4d6d;p=ldk-java [Java] Update HumanObjectPeerTest to test Scorer serialization This doesn't appear to change much, but it seems nicer to. As of this commit, the total leaks during a full Java test run are 25 allocations remained for 1115532 bytes. --- diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index 7f23056d..c4f1b906 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -356,8 +356,11 @@ class HumanObjectPeerTestInstance { this.constructor = new ChannelManagerConstructor(Network.LDKNetwork_Bitcoin, UserConfig.with_default(), new byte[32], 0, this.keys_interface, this.fee_estimator, this.chain_monitor, this.router, this.tx_broadcaster, this.logger); } + Result_ScorerDecodeErrorZ score_res = Scorer.read(Scorer.with_default().write()); + assert score_res.is_ok(); + Score score = ((Result_ScorerDecodeErrorZ.Result_ScorerDecodeErrorZ_OK) score_res).res.as_Score(); MultiThreadedLockableScore scorer = null; - if (use_invoice_payer) { scorer = MultiThreadedLockableScore.of(Scorer.with_default().as_Score()); } + if (use_invoice_payer) { scorer = MultiThreadedLockableScore.of(score); } constructor.chain_sync_completed(new ChannelManagerConstructor.EventHandler() { @Override public void handle_event(Event event) { synchronized (pending_manager_events) {