From 9d81529eaa0b88f4f9eee894e90029701156b179 Mon Sep 17 00:00:00 2001 From: Sean Gilligan Date: Tue, 22 Aug 2023 13:20:59 -0700 Subject: [PATCH] TransactionConfidence: convert `Factory` to interface --- .../main/java/org/bitcoinj/core/TransactionConfidence.java | 6 ++---- core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java b/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java index 6418de046..4b864ec9b 100644 --- a/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java +++ b/core/src/main/java/org/bitcoinj/core/TransactionConfidence.java @@ -73,10 +73,8 @@ import static org.bitcoinj.base.internal.Preconditions.checkState; */ public class TransactionConfidence { @VisibleForTesting - static class Factory { - public TransactionConfidence createConfidence(Sha256Hash hash) { - return new TransactionConfidence(hash); - } + interface Factory { + TransactionConfidence createConfidence(Sha256Hash hash); } /** diff --git a/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java b/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java index 7b8d7712b..d126be0ec 100644 --- a/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java +++ b/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java @@ -68,7 +68,7 @@ public class TxConfidenceTable { * @param size Max number of transactions to track. The table will fill up to this size then stop growing. */ public TxConfidenceTable(final int size) { - this(size, new TransactionConfidence.Factory()); + this(size, TransactionConfidence::new); } TxConfidenceTable(final int size, TransactionConfidence.Factory confidenceFactory){