public final class BlockchainProcessorImpl extends java.lang.Object implements BlockchainProcessor
BlockchainProcessor.BlockNotAcceptedException, BlockchainProcessor.BlockOfLowerDifficultyException, BlockchainProcessor.BlockOutOfOrderException, BlockchainProcessor.Event, BlockchainProcessor.TransactionNotAcceptedException
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(Listener<Block> listener,
BlockchainProcessor.Event eventType) |
void |
fullReset() |
void |
fullScanWithShutdown() |
void |
generateBlock(byte[] privateKey,
int blockTimestamp) |
long |
getGenesisBlockId() |
int |
getInitialScanHeight() |
static BlockchainProcessorImpl |
getInstance() |
Peer |
getLastBlockchainFeeder() |
int |
getLastBlockchainFeederHeight() |
int |
getMinRollbackHeight() |
static void |
init() |
boolean |
isDownloading() |
boolean |
isDownloadSuspended() |
boolean |
isProcessingBlock() |
boolean |
isScanning() |
java.util.List<BlockImpl> |
popOffTo(int height) |
void |
processPeerBlock(Block inputBlock)
Process a single peer block
The block must be a continuation of the current chain or a replacement for the current last block
|
void |
processPeerBlocks(java.util.List<Block> inputBlocks)
Process multiple peer blocks
The peer blocks must represent a 2-block fork where the common block is the block preceding
the current last block.
|
void |
registerDerivedTable(DerivedDbTable table) |
boolean |
removeListener(Listener<Block> listener,
BlockchainProcessor.Event eventType) |
int |
restorePrunedData(Chain chain) |
Transaction |
restorePrunedTransaction(Chain chain,
byte[] transactionFullHash) |
void |
scan(int height,
boolean validate) |
void |
scheduleScan(int height,
boolean validate) |
void |
setGetMoreBlocks(boolean getMoreBlocks) |
void |
shutdown() |
void |
suspendDownload(boolean suspend) |
void |
trimDerivedTables() |
public static BlockchainProcessorImpl getInstance()
public static void init()
public boolean addListener(Listener<Block> listener, BlockchainProcessor.Event eventType)
addListener
in interface Observable<Block,BlockchainProcessor.Event>
public boolean removeListener(Listener<Block> listener, BlockchainProcessor.Event eventType)
removeListener
in interface Observable<Block,BlockchainProcessor.Event>
public void registerDerivedTable(DerivedDbTable table)
registerDerivedTable
in interface BlockchainProcessor
public void trimDerivedTables()
trimDerivedTables
in interface BlockchainProcessor
public Peer getLastBlockchainFeeder()
getLastBlockchainFeeder
in interface BlockchainProcessor
public int getLastBlockchainFeederHeight()
getLastBlockchainFeederHeight
in interface BlockchainProcessor
public boolean isScanning()
isScanning
in interface BlockchainProcessor
public int getInitialScanHeight()
getInitialScanHeight
in interface BlockchainProcessor
public void suspendDownload(boolean suspend)
suspendDownload
in interface BlockchainProcessor
public boolean isDownloadSuspended()
isDownloadSuspended
in interface BlockchainProcessor
public boolean isDownloading()
isDownloading
in interface BlockchainProcessor
public boolean isProcessingBlock()
isProcessingBlock
in interface BlockchainProcessor
public int getMinRollbackHeight()
getMinRollbackHeight
in interface BlockchainProcessor
public long getGenesisBlockId()
getGenesisBlockId
in interface BlockchainProcessor
public void processPeerBlock(Block inputBlock) throws NxtException
processPeerBlock
in interface BlockchainProcessor
inputBlock
- Peer blockNxtException
- Block was not acceptedpublic void processPeerBlocks(java.util.List<Block> inputBlocks) throws NxtException
processPeerBlocks
in interface BlockchainProcessor
inputBlocks
- Peer blocksNxtException
- Blocks were not acceptedpublic java.util.List<BlockImpl> popOffTo(int height)
popOffTo
in interface BlockchainProcessor
public void fullReset()
fullReset
in interface BlockchainProcessor
public void setGetMoreBlocks(boolean getMoreBlocks)
setGetMoreBlocks
in interface BlockchainProcessor
public int restorePrunedData(Chain chain)
restorePrunedData
in interface BlockchainProcessor
public Transaction restorePrunedTransaction(Chain chain, byte[] transactionFullHash)
restorePrunedTransaction
in interface BlockchainProcessor
public void shutdown()
public void generateBlock(byte[] privateKey, int blockTimestamp) throws BlockchainProcessor.BlockNotAcceptedException
public void scheduleScan(int height, boolean validate)
public void scan(int height, boolean validate)
scan
in interface BlockchainProcessor
public void fullScanWithShutdown()
fullScanWithShutdown
in interface BlockchainProcessor