mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-26 01:56:44 +00:00
move confirmation logic to blocktransactionhash
This commit is contained in:
parent
d2582c0414
commit
fff658a3ab
1 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue