/** * The flags indicating which block validation tests should be applied to * the given block. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Block.VerifyFlag> getBlockVerificationFlags(final Block block, final VersionTally tally, final Integer height) { final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class); if (block.isBIP34()) { final Integer count = tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP34); if (null != count && count >= getMajorityEnforceBlockUpgrade()) { flags.add(Block.VerifyFlag.HEIGHT_IN_COINBASE); } } return flags; }
/** * The flags indicating which block validation tests should be applied to * the given block. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Block.VerifyFlag> getBlockVerificationFlags(final Block block, final VersionTally tally, final Integer height) { final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class); if (block.isBIP34()) { final Integer count = tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP34); if (null != count && count >= getMajorityEnforceBlockUpgrade()) { flags.add(Block.VerifyFlag.HEIGHT_IN_COINBASE); } } return flags; }
/** * The flags indicating which block validation tests should be applied to * the given block. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Block.VerifyFlag> getBlockVerificationFlags(final Block block, final VersionTally tally, final Integer height) { final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class); if (block.isBIP34()) { final Integer count = tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP34); if (null != count && count >= getMajorityEnforceBlockUpgrade()) { flags.add(Block.VerifyFlag.HEIGHT_IN_COINBASE); } } return flags; }
/** * The flags indicating which block validation tests should be applied to * the given block. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Block.VerifyFlag> getBlockVerificationFlags(final Block block, final VersionTally tally, final Integer height) { final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class); if (block.isBIP34()) { final Integer count = tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP34); if (null != count && count >= getMajorityEnforceBlockUpgrade()) { flags.add(Block.VerifyFlag.HEIGHT_IN_COINBASE); } } return flags; }
/** * The flags indicating which script validation tests should be applied to * the given transaction. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block the transaction belongs to. * @param transaction to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Script.VerifyFlag> getTransactionVerificationFlags(final Block block, final Transaction transaction, final VersionTally tally, final Integer height) { final EnumSet<Script.VerifyFlag> verifyFlags = EnumSet.noneOf(Script.VerifyFlag.class); if (block.getTimeSeconds() >= NetworkParameters.BIP16_ENFORCE_TIME) verifyFlags.add(Script.VerifyFlag.P2SH); // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4 // blocks, when 75% of the network has upgraded: if (block.getVersion() >= Block.BLOCK_VERSION_BIP65 && tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP65) > this.getMajorityEnforceBlockUpgrade()) { verifyFlags.add(Script.VerifyFlag.CHECKLOCKTIMEVERIFY); } return verifyFlags; }
/** * The flags indicating which script validation tests should be applied to * the given transaction. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block the transaction belongs to. * @param transaction to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Script.VerifyFlag> getTransactionVerificationFlags(final Block block, final Transaction transaction, final VersionTally tally, final Integer height) { final EnumSet<Script.VerifyFlag> verifyFlags = EnumSet.noneOf(Script.VerifyFlag.class); if (block.getTimeSeconds() >= NetworkParameters.BIP16_ENFORCE_TIME) verifyFlags.add(Script.VerifyFlag.P2SH); // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4 // blocks, when 75% of the network has upgraded: if (block.getVersion() >= Block.BLOCK_VERSION_BIP65 && tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP65) > this.getMajorityEnforceBlockUpgrade()) { verifyFlags.add(Script.VerifyFlag.CHECKLOCKTIMEVERIFY); } return verifyFlags; }
/** * The flags indicating which script validation tests should be applied to * the given transaction. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block the transaction belongs to. * @param transaction to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Script.VerifyFlag> getTransactionVerificationFlags(final Block block, final Transaction transaction, final VersionTally tally, final Integer height) { final EnumSet<Script.VerifyFlag> verifyFlags = EnumSet.noneOf(Script.VerifyFlag.class); if (block.getTimeSeconds() >= NetworkParameters.BIP16_ENFORCE_TIME) verifyFlags.add(Script.VerifyFlag.P2SH); // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4 // blocks, when 75% of the network has upgraded: if (block.getVersion() >= Block.BLOCK_VERSION_BIP65 && tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP65) > this.getMajorityEnforceBlockUpgrade()) { verifyFlags.add(Script.VerifyFlag.CHECKLOCKTIMEVERIFY); } return verifyFlags; }
/** * The flags indicating which script validation tests should be applied to * the given transaction. Enables support for alternative blockchains which enable * tests based on different criteria. * * @param block block the transaction belongs to. * @param transaction to determine flags for. * @param height height of the block, if known, null otherwise. Returned * tests should be a safe subset if block height is unknown. */ public EnumSet<Script.VerifyFlag> getTransactionVerificationFlags(final Block block, final Transaction transaction, final VersionTally tally, final Integer height) { final EnumSet<Script.VerifyFlag> verifyFlags = EnumSet.noneOf(Script.VerifyFlag.class); if (block.getTimeSeconds() >= NetworkParameters.BIP16_ENFORCE_TIME) verifyFlags.add(Script.VerifyFlag.P2SH); // Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4 // blocks, when 75% of the network has upgraded: if (block.getVersion() >= Block.BLOCK_VERSION_BIP65 && tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP65) > this.getMajorityEnforceBlockUpgrade()) { verifyFlags.add(Script.VerifyFlag.CHECKLOCKTIMEVERIFY); } return verifyFlags; }
final int UNDOABLE_BLOCKS_STORED = PARAMS.getMajorityEnforceBlockUpgrade() + 1; store = createStore(PARAMS, UNDOABLE_BLOCKS_STORED); try { for (height = 1; height <= (PARAMS.getMajorityWindow() - PARAMS.getMajorityEnforceBlockUpgrade()); height++) { chainHead = chainHead.createNextBlockWithCoinbase(Block.BLOCK_VERSION_GENESIS, outKey.getPubKey(), height);