@Test public void testGetSmallBlock() { Block block = createBlock(); SmallBlock smallBlock = ConsensusTool.getSmallBlock(block); assertNotNull(smallBlock); assertEquals(smallBlock.getHeader(), block.getHeader()); assertEquals(smallBlock.getSubTxList().size() , 0); assertEquals(smallBlock.getTxHashList().get(0), block.getTxs().get(0).getHash()); }
public static SmallBlock getSmallBlock(Block block) { SmallBlock smallBlock = new SmallBlock(); smallBlock.setHeader(block.getHeader()); List<NulsDigestData> txHashList = new ArrayList<>(); for (Transaction tx : block.getTxs()) { txHashList.add(tx.getHash()); if (tx.isSystemTx()) { smallBlock.addBaseTx(tx); } } smallBlock.setTxHashList(txHashList); return smallBlock; }
ConsensusTool { public static SmallBlock getSmallBlock(Block block) { SmallBlock smallBlock = new SmallBlock(); smallBlock.setHeader(block.getHeader()); List<NulsDigestData> txHashList = new ArrayList<>(); for (Transaction tx : block.getTxs()) { txHashList.add(tx.getHash()); if (tx.isSystemTx()) { smallBlock.addBaseTx(tx); } } smallBlock.setTxHashList(txHashList); return smallBlock; } }
ConsensusTool { public static SmallBlock getSmallBlock(Block block) { SmallBlock smallBlock = new SmallBlock(); smallBlock.setHeader(block.getHeader()); List<NulsDigestData> txHashList = new ArrayList<>(); for (Transaction tx : block.getTxs()) { txHashList.add(tx.getHash()); if (tx.isSystemTx()) { smallBlock.addBaseTx(tx); } } smallBlock.setTxHashList(txHashList); return smallBlock; }  }
ConsensusTool { public static SmallBlock getSmallBlock(Block block) { SmallBlock smallBlock = new SmallBlock(); smallBlock.setHeader(block.getHeader()); List<NulsDigestData> txHashList = new ArrayList<>(); for (Transaction tx : block.getTxs()) { txHashList.add(tx.getHash()); if (tx.isSystemTx()) { smallBlock.addBaseTx(tx); } } smallBlock.setTxHashList(txHashList); return smallBlock; }  static SmallBlock getSmallBlock(Block block); static Block createBlock(BlockData blockData, Account account); static CoinBaseTransaction createCoinBaseTx(MeetingMember member, List<Transaction> txList, MeetingRound localRound, long unlockHeight); static YellowPunishTransaction createYellowPunishTx(Block preBlock, MeetingMember self, MeetingRound round); static CoinData getStopAgentCoinData(Agent agent, long lockTime); static CoinData getStopAgentCoinData(Agent agent, long lockTime, Long hight); static CoinData getStopAgentCoinData(byte[] address, long lockTime); static byte[] getStateRoot(BlockHeader blockHeader); }
ConsensusTool { public static SmallBlock getSmallBlock(Block block) { SmallBlock smallBlock = new SmallBlock(); smallBlock.setHeader(block.getHeader()); List<NulsDigestData> txHashList = new ArrayList<>(); for (Transaction tx : block.getTxs()) { txHashList.add(tx.getHash()); if (tx.isSystemTx()) { smallBlock.addBaseTx(tx); } } smallBlock.setTxHashList(txHashList); return smallBlock; }  static SmallBlock getSmallBlock(Block block); static Block createBlock(BlockData blockData, Account account); static CoinBaseTransaction createCoinBaseTx(MeetingMember member, List<Transaction> txList, MeetingRound localRound, long unlockHeight); static YellowPunishTransaction createYellowPunishTx(Block preBlock, MeetingMember self, MeetingRound round); static CoinData getStopAgentCoinData(Agent agent, long lockTime); static CoinData getStopAgentCoinData(Agent agent, long lockTime, Long hight); static CoinData getStopAgentCoinData(byte[] address, long lockTime); static byte[] getStateRoot(BlockHeader blockHeader);  }