Search in sources :

Example 1 with RedPunishTransaction

use of io.nuls.consensus.entity.tx.RedPunishTransaction in project nuls by nuls-io.

the class ConsensusMeetingRunner method redPunishTx.

private void redPunishTx(Block bestBlock, List<Transaction> txList) throws NulsException, IOException {
    // todo check it
    for (long height : punishMap.keySet()) {
        RedPunishData data = punishMap.get(height);
        punishMap.remove(height);
        if (data.getHeight() < (bestBlock.getHeader().getHeight() + 1)) {
            continue;
        }
        RedPunishTransaction tx = new RedPunishTransaction();
        tx.setTxData(data);
        tx.setTime(TimeService.currentTimeMillis());
        tx.setFee(Na.ZERO);
        tx.setHash(NulsDigestData.calcDigestData(tx));
        tx.setScriptSig(accountService.createP2PKHScriptSigFromDigest(tx.getHash(), consensusManager.getConsensusStatusInfo().getAccount(), NulsContext.CACHED_PASSWORD_OF_WALLET).serialize());
        txList.add(tx);
    }
}
Also used : RedPunishTransaction(io.nuls.consensus.entity.tx.RedPunishTransaction) RedPunishData(io.nuls.consensus.entity.RedPunishData)

Aggregations

RedPunishData (io.nuls.consensus.entity.RedPunishData)1 RedPunishTransaction (io.nuls.consensus.entity.tx.RedPunishTransaction)1