keep block hash

This commit is contained in:
Craig Raw 2020-06-11 16:59:24 +02:00
parent 728b6ce5ef
commit 75701c725d

View file

@ -7,16 +7,26 @@ import java.util.Date;
public class BlockTransaction extends BlockTransactionHash implements Comparable<BlockTransaction> { public class BlockTransaction extends BlockTransactionHash implements Comparable<BlockTransaction> {
private final Transaction transaction; private final Transaction transaction;
private final Sha256Hash blockHash;
public BlockTransaction(Sha256Hash hash, int height, Date date, Long fee, Transaction transaction) { public BlockTransaction(Sha256Hash hash, int height, Date date, Long fee, Transaction transaction) {
this(hash, height, date, fee, transaction, null);
}
public BlockTransaction(Sha256Hash hash, int height, Date date, Long fee, Transaction transaction, Sha256Hash blockHash) {
super(hash, height, date, fee); super(hash, height, date, fee);
this.transaction = transaction; this.transaction = transaction;
this.blockHash = blockHash;
} }
public Transaction getTransaction() { public Transaction getTransaction() {
return transaction; return transaction;
} }
public Sha256Hash getBlockHash() {
return blockHash;
}
@Override @Override
public int compareTo(BlockTransaction blockchainTransaction) { public int compareTo(BlockTransaction blockchainTransaction) {
return super.compareTo(blockchainTransaction); return super.compareTo(blockchainTransaction);