nodecore-spv/src/main/java/veriblock/SpvContext.java
/**
     * Initialise context. This method should be call on the start app.
     *
     * @param networkParam   Config for particular network.
     * @param baseDir        will use as a start point for inner directories. (db, wallet so on.)
     * @param filePr         prefix for wallet name. (for example: vbk-MainNet, vbk-TestNet)
     * @param peerDiscovery  discovery peers.
     * @param runAdminServer Start Admin RPC service. (It can be not necessary for tests.)
     */
Initialise context. This method should be call on the start app.
@param networkParam   Config for particular network.
@param baseDir        will use as a start point for inner directories. (db, wallet so on.)
@param filePr         prefix for wallet name. (for example: vbk-MainNet, vbk-TestNet)
@param peerDiscovery  discovery peers.
@param runAdminServer Start Admin RPC service. (It can be not necessary for tests.)
Initialise context . This method should be call on the start app . @param networkParam Config for particular network . @param baseDir will use as a start point for inner directories . ( db wallet so on . ) @param filePr prefix for wallet name . ( for example : vbk - MainNet vbk - TestNet ) @param peerDiscovery discovery peers . @param runAdminServer Start Admin RPC service . ( It can be not necessary for tests . )
public synchronized void init(NetworkParameters networkParam, File baseDir, String filePr, PeerDiscovery peerDiscovery, boolean runAdminServer) {
        try {
            Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown, "ShutdownHook nodecore-spv"));
            networkParameters = networkParam;
            directory = baseDir;
            filePrefix = filePr;
            String databasePath = Paths.get(FileManager.getDataDirectory(), networkParam.getDatabaseName()).toString();
            veriBlockStore = new VeriBlockStore(ConnectionSelector.setConnection(databasePath));
            bitcoinStore = new BitcoinStore(ConnectionSelector.setConnection(databasePath));
            init(veriBlockStore, networkParameters);
            init(bitcoinStore, networkParameters);
            auditStore = new AuditorChangesStore(ConnectionSelector.setConnectionDefault());
            transactionPool = new TransactionPool();
            blockchain = new Blockchain(networkParameters.getGenesisBlock(), veriBlockStore);
            pendingTransactionContainer = new PendingTransactionContainerImpl();
            p2PService = new P2PServiceImpl(pendingTransactionContainer, networkParameters);
            addressManager = new DefaultAddressManager();
            File walletFile = new File(getDirectory(), getFilePrefix() + FILE_EXTENSION);
            addressManager.load(walletFile);
            peerTable = new PeerTableImpl(this, p2PService, peerDiscovery, pendingTransactionContainer);
            transactionService = new TransactionService(addressManager, networkParameters);
            adminApiService =
                new AdminApiServiceImpl(this, peerTable, transactionService, addressManager, new TransactionFactoryImpl(networkParameters),
                    pendingTransactionContainer, blockchain
                );
            adminService = new AdminServiceFacade(adminApiService);
            adminServerInterceptor = new AdminServerInterceptor();
            if (runAdminServer) {
                server = createAdminServer();
            }
            pendingTransactionDownloadedListener = new PendingTransactionDownloadedListenerImpl(this);
        } catch (Exception e) {
            log.error("Could not initialize VeriBlock security", e);
            throw new RuntimeException(e);
        }
    }
public synchronized void init ( NetworkParameters networkParam , File baseDir , String filePr , PeerDiscovery peerDiscovery , boolean runAdminServer ) { try { Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( this :: shutdown , "ShutdownHook nodecore-spv" ) ) ; networkParameters = networkParam ; directory = baseDir ; filePrefix = filePr ; String databasePath = Paths . get ( FileManager . getDataDirectory ( ) , networkParam . getDatabaseName ( ) ) . toString ( ) ; veriBlockStore = new VeriBlockStore ( ConnectionSelector . setConnection ( databasePath ) ) ; bitcoinStore = new BitcoinStore ( ConnectionSelector . setConnection ( databasePath ) ) ; init ( veriBlockStore , networkParameters ) ; init ( bitcoinStore , networkParameters ) ; auditStore = new AuditorChangesStore ( ConnectionSelector . setConnectionDefault ( ) ) ; transactionPool = new TransactionPool ( ) ; blockchain = new Blockchain ( networkParameters . getGenesisBlock ( ) , veriBlockStore ) ; pendingTransactionContainer = new PendingTransactionContainerImpl ( ) ; p2PService = new P2PServiceImpl ( pendingTransactionContainer , networkParameters ) ; addressManager = new DefaultAddressManager ( ) ; File walletFile = new File ( getDirectory ( ) , getFilePrefix ( ) + FILE_EXTENSION ) ; addressManager . load ( walletFile ) ; peerTable = new PeerTableImpl ( this , p2PService , peerDiscovery , pendingTransactionContainer ) ; transactionService = new TransactionService ( addressManager , networkParameters ) ; adminApiService = new AdminApiServiceImpl ( this , peerTable , transactionService , addressManager , new TransactionFactoryImpl ( networkParameters ) , pendingTransactionContainer , blockchain ) ; adminService = new AdminServiceFacade ( adminApiService ) ; adminServerInterceptor = new AdminServerInterceptor ( ) ; if ( runAdminServer ) { server = createAdminServer ( ) ; } pendingTransactionDownloadedListener = new PendingTransactionDownloadedListenerImpl ( this ) ; } catch ( Exception e ) { log . error ( "Could not initialize VeriBlock security" , e ) ; throw new RuntimeException ( e ) ; } }
Initialise context.
Initialise context .