Search in sources :

Example 1 with UtxoLedgerModuleBootstrap

use of io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap in project nuls by nuls-io.

the class BlockServiceImplTest method init.

@Before
public void init() {
    MicroKernelBootstrap mk = MicroKernelBootstrap.getInstance();
    mk.init();
    mk.start();
    LevelDbModuleBootstrap bootstrap = new LevelDbModuleBootstrap();
    bootstrap.init();
    bootstrap.start();
    UtxoLedgerModuleBootstrap ledgerModuleBootstrap = new UtxoLedgerModuleBootstrap();
    ledgerModuleBootstrap.init();
    ledgerModuleBootstrap.start();
    service = NulsContext.getServiceBean(BlockService.class);
    Block block = new Block();
    BlockHeader blockHeader = new BlockHeader();
    blockHeader.setHash(NulsDigestData.calcDigestData("hashhash".getBytes()));
    blockHeader.setHeight(1286L);
    blockHeader.setExtend("extends".getBytes());
    blockHeader.setMerkleHash(NulsDigestData.calcDigestData("merkleHash".getBytes()));
    blockHeader.setPreHash(NulsDigestData.calcDigestData("prehash".getBytes()));
    try {
        blockHeader.setPackingAddress("address".getBytes());
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
    blockHeader.setBlockSignature(new BlockSignature());
    blockHeader.setTime(12345678901L);
    blockHeader.setTxCount(3);
    List<NulsDigestData> txHashList = new ArrayList<>();
    txHashList.add(NulsDigestData.calcDigestData("first-tx-hash".getBytes()));
    txHashList.add(NulsDigestData.calcDigestData("second-tx-hash".getBytes()));
    txHashList.add(NulsDigestData.calcDigestData("third-tx-hash".getBytes()));
// block.setTxHashList(txHashList);
// this.model = blockHeader;
}
Also used : LevelDbModuleBootstrap(io.nuls.db.module.impl.LevelDbModuleBootstrap) BlockSignature(io.nuls.kernel.script.BlockSignature) UtxoLedgerModuleBootstrap(io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap) ArrayList(java.util.ArrayList) BlockService(io.nuls.protocol.service.BlockService) Block(io.nuls.kernel.model.Block) NulsDigestData(io.nuls.kernel.model.NulsDigestData) BlockHeader(io.nuls.kernel.model.BlockHeader) MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap) Before(org.junit.Before)

Example 2 with UtxoLedgerModuleBootstrap

use of io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap in project nuls by nuls-io.

the class TransactionServiceImplTest method init.

@Before
public void init() {
    MicroKernelBootstrap mk = MicroKernelBootstrap.getInstance();
    mk.init();
    mk.start();
    LevelDbModuleBootstrap bootstrap = new LevelDbModuleBootstrap();
    bootstrap.init();
    bootstrap.start();
    UtxoLedgerModuleBootstrap ledgerModuleBootstrap = new UtxoLedgerModuleBootstrap();
    ledgerModuleBootstrap.init();
    ledgerModuleBootstrap.start();
    NettyNetworkModuleBootstrap networkModuleBootstrap = new NettyNetworkModuleBootstrap();
    networkModuleBootstrap.init();
    networkModuleBootstrap.start();
    transactionService = SpringLiteContext.getBean(TransactionService.class);
    initTxList();
}
Also used : LevelDbModuleBootstrap(io.nuls.db.module.impl.LevelDbModuleBootstrap) TransactionService(io.nuls.protocol.service.TransactionService) UtxoLedgerModuleBootstrap(io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap) NettyNetworkModuleBootstrap(io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap) MicroKernelBootstrap(io.nuls.kernel.MicroKernelBootstrap) Before(org.junit.Before)

Aggregations

LevelDbModuleBootstrap (io.nuls.db.module.impl.LevelDbModuleBootstrap)2 MicroKernelBootstrap (io.nuls.kernel.MicroKernelBootstrap)2 UtxoLedgerModuleBootstrap (io.nuls.ledger.module.impl.UtxoLedgerModuleBootstrap)2 Before (org.junit.Before)2 Block (io.nuls.kernel.model.Block)1 BlockHeader (io.nuls.kernel.model.BlockHeader)1 NulsDigestData (io.nuls.kernel.model.NulsDigestData)1 BlockSignature (io.nuls.kernel.script.BlockSignature)1 NettyNetworkModuleBootstrap (io.nuls.network.netty.module.impl.NettyNetworkModuleBootstrap)1 BlockService (io.nuls.protocol.service.BlockService)1 TransactionService (io.nuls.protocol.service.TransactionService)1 ArrayList (java.util.ArrayList)1