qortal/src/repository/BlockRepository.java
catbref 698c4b6cc9 More repository work
Moved more repository-like methods from qora.* classes to repository.

Removed qora.block.BlockTransaction as it's pretty much internal to the HSQLDB repository.

Fixing qora.account.*

Fixing genesis-related classes: block, account, transaction...
2018-06-12 14:54:06 +01:00

40 lines
1.1 KiB
Java

package repository;
import java.util.List;
import data.block.BlockData;
import data.block.BlockTransactionData;
import data.transaction.TransactionData;
public interface BlockRepository {
public BlockData fromSignature(byte[] signature) throws DataException;
public BlockData fromReference(byte[] reference) throws DataException;
public BlockData fromHeight(int height) throws DataException;
/**
* Return height of block in blockchain using block's signature.
*
* @param signature
* @return height, or 0 if not found in blockchain.
* @throws DataException
*/
public int getHeightFromSignature(byte[] signature) throws DataException;
/**
* Return highest block height from DB.
*
* @return height, or 0 if there are no blocks in DB (not very likely).
*/
public int getBlockchainHeight() throws DataException;
public List<TransactionData> getTransactionsFromSignature(byte[] signature) throws DataException;
public void save(BlockData blockData) throws DataException;
public void save(BlockTransactionData blockTransactionData) throws DataException;
}