nxt.blockchain

## Class BlockchainProcessorImpl

- java.lang.Object
- - nxt.blockchain.BlockchainProcessorImpl

- All Implemented Interfaces:
    BlockchainProcessor, Observable<Block,BlockchainProcessor.Event>

      public final class BlockchainProcessorImpl
      extends java.lang.Object
      implements BlockchainProcessor

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface nxt.blockchain.BlockchainProcessor

      `BlockchainProcessor.BlockNotAcceptedException, BlockchainProcessor.BlockOfLowerDifficultyException, BlockchainProcessor.BlockOutOfOrderException, BlockchainProcessor.Event, BlockchainProcessor.TransactionNotAcceptedException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addListener(Listener<Block> listener, BlockchainProcessor.Event eventType)`
    `void` | `fullReset()`
    `void` | `fullScanWithShutdown()`
    `void` | `generateBlock(java.lang.String secretPhrase, 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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getInstance

          public static BlockchainProcessorImpl getInstance()

    - #### init

          public static void init()

    - #### addListener

          public boolean addListener(Listener<Block> listener,
                                     BlockchainProcessor.Event eventType)

      Specified by:
        `addListener` in interface `Observable<Block,BlockchainProcessor.Event>`

    - #### removeListener

          public boolean removeListener(Listener<Block> listener,
                                        BlockchainProcessor.Event eventType)

      Specified by:
        `removeListener` in interface `Observable<Block,BlockchainProcessor.Event>`

    - #### registerDerivedTable

          public void registerDerivedTable(DerivedDbTable table)

      Specified by:
        `registerDerivedTable` in interface `BlockchainProcessor`

    - #### trimDerivedTables

          public void trimDerivedTables()

      Specified by:
        `trimDerivedTables` in interface `BlockchainProcessor`

    - #### getLastBlockchainFeeder

          public Peer getLastBlockchainFeeder()

      Specified by:
        `getLastBlockchainFeeder` in interface `BlockchainProcessor`

    - #### getLastBlockchainFeederHeight

          public int getLastBlockchainFeederHeight()

      Specified by:
        `getLastBlockchainFeederHeight` in interface `BlockchainProcessor`

    - #### isScanning

          public boolean isScanning()

      Specified by:
        `isScanning` in interface `BlockchainProcessor`

    - #### getInitialScanHeight

          public int getInitialScanHeight()

      Specified by:
        `getInitialScanHeight` in interface `BlockchainProcessor`

    - #### suspendDownload

          public void suspendDownload(boolean suspend)

      Specified by:
        `suspendDownload` in interface `BlockchainProcessor`

    - #### isDownloadSuspended

          public boolean isDownloadSuspended()

      Specified by:
        `isDownloadSuspended` in interface `BlockchainProcessor`

    - #### isDownloading

          public boolean isDownloading()

      Specified by:
        `isDownloading` in interface `BlockchainProcessor`

    - #### isProcessingBlock

          public boolean isProcessingBlock()

      Specified by:
        `isProcessingBlock` in interface `BlockchainProcessor`

    - #### getMinRollbackHeight

          public int getMinRollbackHeight()

      Specified by:
        `getMinRollbackHeight` in interface `BlockchainProcessor`

    - #### getGenesisBlockId

          public long getGenesisBlockId()

      Specified by:
        `getGenesisBlockId` in interface `BlockchainProcessor`

    - #### processPeerBlock

          public void processPeerBlock(Block inputBlock)
                                throws NxtException

      Process a single peer block The block must be a continuation of the current chain or a replacement for the current last block
      Specified by:
        `processPeerBlock` in interface `BlockchainProcessor`
      Parameters:
        `inputBlock` - Peer block
      Throws:
        `NxtException` - Block was not accepted

    - #### processPeerBlocks

          public void processPeerBlocks(java.util.List<Block> inputBlocks)
                                 throws NxtException

      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.
      Specified by:
        `processPeerBlocks` in interface `BlockchainProcessor`
      Parameters:
        `inputBlocks` - Peer blocks
      Throws:
        `NxtException` - Blocks were not accepted

    - #### popOffTo

          public java.util.List<BlockImpl> popOffTo(int height)

      Specified by:
        `popOffTo` in interface `BlockchainProcessor`

    - #### fullReset

          public void fullReset()

      Specified by:
        `fullReset` in interface `BlockchainProcessor`

    - #### setGetMoreBlocks

          public void setGetMoreBlocks(boolean getMoreBlocks)

      Specified by:
        `setGetMoreBlocks` in interface `BlockchainProcessor`

    - #### restorePrunedData

          public int restorePrunedData(Chain chain)

      Specified by:
        `restorePrunedData` in interface `BlockchainProcessor`

    - #### restorePrunedTransaction

          public Transaction restorePrunedTransaction(Chain chain,
                                                      byte[] transactionFullHash)

      Specified by:
        `restorePrunedTransaction` in interface `BlockchainProcessor`

    - #### shutdown

          public void shutdown()

    - #### generateBlock

          public void generateBlock(java.lang.String secretPhrase,
                                    int blockTimestamp)
                             throws BlockchainProcessor.BlockNotAcceptedException

      Throws:
        `BlockchainProcessor.BlockNotAcceptedException`

    - #### scheduleScan

          public void scheduleScan(int height,
                                   boolean validate)

    - #### scan

          public void scan(int height,
                           boolean validate)

      Specified by:
        `scan` in interface `BlockchainProcessor`

    - #### fullScanWithShutdown

          public void fullScanWithShutdown()

      Specified by:
        `fullScanWithShutdown` in interface `BlockchainProcessor`