code: private void checkTransactions(final int height, final EnumSet<VerifyFlag> flags)
              throws VerificationException {
          // The first transaction in a block must always be a coinbase transaction.
          if (!transactions.get(0).isCoinBase())
              throw new VerificationException("First tx is not coinbase");
          if (flags.contains(Block.VerifyFlag.HEIGHT_IN_COINBASE) && height >= BLOCK_HEIGHT_GENESIS) {
              transactions.get(0).checkCoinBaseHeight(height);
          }
          // The rest must not be.
          for (int i = 1; i < transactions.size(); i++) {
              if (transactions.get(i).isCoinBase())
                  throw new VerificationException("TX " + i + " is coinbase when it should not be.");
          }
      }
docs: Verify the transactions on a block.
  
  @param height block height, if known, or -1 otherwise. If provided, used
  to validate the coinbase input script of v2 and above blocks.
  @throws VerificationException if there was an error verifying the block.