use of com.jd.blockchain.consensus.raft.consensus.Block in project jdchain-core by blockchain-jd-com.
the class BlockProposerServiceTest method testProposalBlock.
@Test
public void testProposalBlock() {
RaftNodeServer server = new RaftNodeServer(null, null, null);
BlockProposerService proposer = new BlockProposerService(mockLedgerRepository);
Block b1 = proposer.proposeBlock(Lists.newArrayList(new byte[][] {}));
Block b2 = proposer.proposeBlock(Lists.newArrayList(new byte[][] {}));
Block b3 = proposer.proposeBlock(Lists.newArrayList(new byte[][] {}));
Block b4 = proposer.proposeBlock(Lists.newArrayList(new byte[][] {}));
Block b5 = proposer.proposeBlock(Lists.newArrayList(new byte[][] {}));
Block b6 = proposer.proposeBlock(Lists.newArrayList(new byte[][] {}));
b1.setCurrentBlockHash(Crypto.resolveAsHashDigest(Base58Utils.decode("b1")));
proposer.commitCallBack(b1, true);
b2.setCurrentBlockHash(Crypto.resolveAsHashDigest(Base58Utils.decode("b2")));
proposer.commitCallBack(b2, true);
b3.setCurrentBlockHash(Crypto.resolveAsHashDigest(Base58Utils.decode("b3")));
proposer.commitCallBack(b3, false);
b4.setCurrentBlockHash(Crypto.resolveAsHashDigest(Base58Utils.decode("b4")));
proposer.commitCallBack(b4, true);
b5.setCurrentBlockHash(Crypto.resolveAsHashDigest(Base58Utils.decode("b5")));
proposer.commitCallBack(b5, false);
b6.setCurrentBlockHash(Crypto.resolveAsHashDigest(Base58Utils.decode("b6")));
proposer.commitCallBack(b6, true);
}
Aggregations