From fff658a3ab33a3f63f5a1cd03c2b7cc1f20bec4a Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Sun, 9 Aug 2020 14:12:40 +0200 Subject: [PATCH] move confirmation logic to blocktransactionhash --- .../drongo/wallet/BlockTransactionHash.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/BlockTransactionHash.java b/src/main/java/com/sparrowwallet/drongo/wallet/BlockTransactionHash.java index a8e75dc..ab9aaf0 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/BlockTransactionHash.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/BlockTransactionHash.java @@ -6,6 +6,9 @@ import java.util.Date; import java.util.Objects; public abstract class BlockTransactionHash { + public static final int BLOCKS_TO_CONFIRM = 6; + public static final int BLOCKS_TO_FULLY_CONFIRM = 100; + private final Sha256Hash hash; private final int height; private final Date date; @@ -32,6 +35,14 @@ public abstract class BlockTransactionHash { return height; } + public int getConfirmations(int currentBlockHeight) { + if(height <= 0) { + return 0; + } + + return currentBlockHeight - height + 1; + } + public Date getDate() { return date; }